Your
dr
variable is a
DataTable
:
DataTable Class (System.Data) | Microsoft Learn[
^]
The
DataTable
class doesn't have an indexer. Asking what value
dr["TestCase5"]
has is like asking what telephone number London is - the question doesn't make sense.
Assuming your
tableCollection
variable does actually contain a collection of
DataTable
objects, and you want to process every
row within those tables, you will need a nested loop to iterate over the rows of the table:
foreach (DataTable table in tableCollection)
{
foreach (DataRow row in table.Rows)
{
if (row["TestCase5"] == 5)
{
row["TestCase5"] = "CDE";
}
}
}