I am having data in Session and casting it to a Datatable.
and I want to delete some of the rows from that Datatable based on a comparison (please the code below).
it doesnt give the expected result.
could you please advise me on this??
DataTable dtchange = (DataTable)Session["Data"];
DataSet ds = getdata(txt_HideDual.Text.ToString());
if (dtchange.Rows.Count != 0)
for (int i = 0; i < dtchange.Rows.Count; i++)
for (int j = 0; j < ds.Tables.Rows.Count; j++)
if (dtchange.Rows[i]["Name"].ToString() == ds.Tables.Rows[j]["Name"].ToString())
//dtchange.Rows.RemoveAt(i); --- This doesnt work
Session["Data"] = dtchange;