I want to run a loop if the relevant table is called table1 or table2. Currently, I’m doing it like this:
foreach (DataTable table in DtSet.Tables)
{
if ((table.TableName == "table1")||(table.TableName == "table2"))
{
foreach (DataRow sourceRow in table.Rows)
{
}
}
}
Is there a way to modify this code so that the name check is done without having to loop through the whole dataset?
Many thanks.
How about something like….