S
Steve Bezner
I have a System.Data.DataTable in memory in which I would like to change the
value of a column for all rows. Is there a method to change all rows to a
specified value?
I know I can loop thru all the records (see below), but I would like to
update the datatable with 1 statement, perhaps an sql update statement? It
would also be useful if I can run an sql update statement on a datatable in
memory, instead of looping.
foreach (System.Data.DataRow row in System.Data.DataTable)
{
row["MyColumn"] = 0; // There has to be better way, then
to loop.....
}
Thanks,
Steve
value of a column for all rows. Is there a method to change all rows to a
specified value?
I know I can loop thru all the records (see below), but I would like to
update the datatable with 1 statement, perhaps an sql update statement? It
would also be useful if I can run an sql update statement on a datatable in
memory, instead of looping.
foreach (System.Data.DataRow row in System.Data.DataTable)
{
row["MyColumn"] = 0; // There has to be better way, then
to loop.....
}
Thanks,
Steve