slow performance with datatable column update

  • Thread starter Thread starter Rich G
  • Start date Start date
R

Rich G

Hi - can anyone comment on why performance would be so
slow to update a DataTable row a simple value? With 3000
rows, it takes 5 seconds, which is unacceptable. Sample
code below. Suggestions?

string colName = "seg_qty";
for (int i=0; i<mwbView.Count; i++)
{
mwbView.Row.BeginEdit();
mwbView.Row[colName] = 0;
mwbView.Row.EndEdit();
}

Thanks,
Rich G
 
The code in the sample was a simple code snippet. In the
real world, I need to be able to set each row to a
different (calculated) value perhaps stored in an array.
One SQL statement is not possible, unless there is one for
each row.

I basically need to set a datatable column (1..rowcount)
to take on the values of an array of the same length/type.
 
you are using data binging, which is slower on performance and easier on
you. sql or sproc.
 
Back
Top