Hi all;
my datatable;
dtData
ID | ID2
--------
1 | 2
1 | 3
dtData.Select("ID = 1"); one more rows;
i want row "ID = 1 And ID2 = 3" how to make ?
Hi all;
my datatable;
dtData
ID | ID2
--------
1 | 2
1 | 3
dtData.Select("ID = 1"); one more rows;
i want row "ID = 1 And ID2 = 3" how to make ?
Okay, here is how I do such things...
GridFieldDAO dao = new GridFieldDAO();
//Load My DataTable
DataTable dt = dao.getDT();
//Get My rows based off selection criteria
DataRow[] drs = dt.Select("(detailID = 1) AND (detailTypeID = 2)");
//make a new "results" datatable via clone to keep structure
DataTable dt2 = dt.Clone();
//Import the Rows
foreach (DataRow d in drs)
{
dt2.ImportRow(d);
}
//Bind to my new DataTable and it will only show rows based off selection
//criteria
myGrid.DataSource = dt2;
myGrid.DataBind();
Notice in my Select() I put the criteria in Parens between AND and OR
Hope this helps! Mike V