By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,731 Members | 1,129 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,731 IT Pros & Developers. It's quick & easy.

slow performance with datatable column update

P: n/a
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[i].Row.BeginEdit();
mwbView[i].Row[colName] = 0;
mwbView[i].Row.EndEdit();
}

Thanks,
Rich G
Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Use one sql statement.

"Rich G" <ri***********@crd.com> wrote in message
news:00****************************@phx.gbl...
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[i].Row.BeginEdit();
mwbView[i].Row[colName] = 0;
mwbView[i].Row.EndEdit();
}

Thanks,
Rich G

Jul 19 '05 #2

P: n/a
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.
Jul 19 '05 #3

P: n/a
you are using data binging, which is slower on performance and easier on
you. sql or sproc.

Rich G wrote:
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[i].Row.BeginEdit();
mwbView[i].Row[colName] = 0;
mwbView[i].Row.EndEdit();
}

Thanks,
Rich G


Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.