ralphtrent
Programmer
Hello
I have a datatable filled with many rows. I used DataTable.Select to filter the rows. I then want to add only add those rows back to the datatable after I remove all other rows.
I have this code in place
I then go through each row and show the value.
When I do that I get blank values, but the row counts = the number of rows I expect after I filter. Am I missing a step?
Thanks
I have a datatable filled with many rows. I used DataTable.Select to filter the rows. I then want to add only add those rows back to the datatable after I remove all other rows.
I have this code in place
Code:
DataTable dt = u.GetIsseDetails_ByUserCustomerId(sUser,iCustomerId);
DataRow[] sdr = dt.Select("iStatusId = " + iStatusId);
dt.Rows.Clear();
for(int i =0; i<sdr.Length; i++)
{
dt.Rows.Add(sdr[i]);
}
I then go through each row and show the value.
Code:
foreach (DataColumn dc in dt.Columns)
{
Console.Write(dc.ColumnName);
Console.Write('\t');
}
Console.WriteLine();
foreach (DataRow dr in dt.Rows)
{
foreach (DataColumn dc in dt.Columns)
{
Console.Write(Convert.ToString(dr[dc]));
Console.Write('\t');
}
Console.WriteLine();
}
When I do that I get blank values, but the row counts = the number of rows I expect after I filter. Am I missing a step?
Thanks