473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

slow performance with datatable column update

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
3 4175
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Gent | last post by:
am using FOR UPDATE triggers to audit a table that has 67 fields. My problem is that this slows down the system significantly. I have narrowed down the problem to the size (Lines of code) that need...
3
by: gizmo | last post by:
I have a stored procedure that queries a database using a Select statement with some inner joins and conditions. With over 9 million records it takes 1 min 36 sec to complete. This is too slow...
5
by: randy | last post by:
Hello all, I have a DataTable which I am building column by column and adding rows after each new column. The DataTable columns match the columns in my database table. I'm building the...
1
by: Luc | last post by:
I am using Visual Studio 2003 and am getting lousy performance after using a datatable select and then trying to assign a value to a column of the row that was found: DataTable dt = new...
2
by: Chris | last post by:
I'm using a DataTable in my application. I am able to load rows into the DataTable quickly. What's puzzling me, however, is that when I update a set of cells in the DataTable, the update is really...
5
by: John Richardson | last post by:
I've been bothered for some time about my DataGrid not populating my rows very quickly. I have about 10K rows loading into the grid. I create a datatable dt with 2 columns, an ID and a display. ...
3
by: Rich G | last post by:
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?...
4
by: Brett Romero | last post by:
I fill a DataTable with search results, which take a very long time if I first clear it. The values come from an object and I map them into the corresponding table columns. I may have 65000...
0
by: Maart_newbie | last post by:
Hi all, I've got a question about returning the value of a pk-column to a DataTable after inserting a row (via a data-adapter) using MySql5. Here is the SQL and code concerned: ...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.