473,405 Members | 2,421 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,405 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 4177
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.