Reputation: 321
I have a DataTable
and I access its rows using a foreach
loop
foreach (DataRow row in table.Rows)
{
userId = Convert.ToInt32(row[BundleSchema.ParamUpdatedBy]);
}
but knowing that my DataTable
contains only a single row
, how can I access it without looping
through it?
Upvotes: 0
Views: 207
Reputation: 1809
You can use Index on Rows
DataRow row = table.Rows[0];
userId = Convert.ToInt32(row[BundleSchema.ParamUpdatedBy]);
Upvotes: 2