Filtering Datatable "dtItem" copy the table to "dt2"
DataTable dtItem=new DataTable();
DataTable dt2=new DataTable();
DataRow[] drs = dtItem.Select("CategoryID =1 ");
//make a new "results" datatable via clone to keep structure
dt2 = dtItem.Clone();
//Import the Rows
foreach (DataRow d in drs)
{
dt2.ImportRow(d);
}
foreach (DataRow dr in dt2.Rows)
{
ItemNamecomboBox2.Items.Add(dr[1].ToString());
}
No comments:
Post a Comment