i am looping through a dataset with 2 loops trying to find the rows which have have their ID matched with the assigned value to an array and if they matched i would like to copy that row into another table. for example:
DataSet dsWinners = new DataSet();
for(int i =0;i<=TotalWinners;i++)
{
for (int j = 1; j <= ds.Tables[0].Rows.Count; j++)
{
//this is my ds table 0
left = Convert.ToInt16(ds.Tables[0].Rows[i]["ID"]);
//this is my array
right = Convert.ToInt16(Winners[i, 0]);
if ( left == right )//if array value matechs with ds.table[0] ID
{
dsWinners.Tables[0].Rows[i] = ds.Tables[0].Rows[j];
}
}
}
how can i get record/row And copy it into a new table and if i cant copy that row like this, is there an alternative way to do it?