后台:
public DataSet ds = new DataSet();
DataView dv = new DataView();
string strDBPath = System.Configuration.ConfigurationSettings.AppSettings["DBPath"];
string strConn = System.Configuration.ConfigurationSettings.AppSettings["Connection"] + Server.MapPath(strDBPath);
OleDbConnection myConnection = new OleDbConnection(strConn);
dr = new OleDbDataAdapter( "Select * From Products", myConnection );
dr.Fill( ds, "tableName" );
dv = ds.Tables["tableName"].DefaultView;
dv.RowFilter = "id='1'";
DataGrid1.DataSource = dv;
DataGrid1.DataBind();
dv.RowFilter = "id='0'";
DataGrid2.DataSource = dv;
DataGrid2.DataBind();
前台:
两个DataGrid控件