473,320 Members | 1,572 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,320 software developers and data experts.

DataTable update cells slow

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 slow

my update code amounts to

dataTable.BeginLoadData()
dataSet.EnforceConstraints = false
tr

for(iRowHandle = 0; iRowHandle < iLimit; iRowHandle++

dataTable.Rows[iRowHandle][iColumn] = szNewValue
finall

dataSet.EnforceRestraints = true
dataTable.EndLoadData()
when I run the above, the update rate is approximately 200 cells/second. This is pathethic. Databases update faster than that. What's weird to me is that I can add rows to the table at about 4000 records/second (each record in this case is 9 columns). So something doesn't add up. Why does the "add-rows" go quickly, but a simple non-key column update is really slow

I must be doing something wrong. But I can't figure out what. It is almost as if each cell update fires a whole bunch of events. But I thought call BegingLoadData, and EnforceRestraints = false were supposed to prevent these events from firing

Can anyone help

Also, does anyone know how to track DataTable events from the debugger

Thanks

Nov 15 '05 #1
2 12007
Check whether u have attached any event handler to columnchanging etc.
Nov 15 '05 #2
I figured out my issue.

I needed to call the DataRow.BeginEdit() prior to setting each value.

Then in my finally clause, I needed to call the dataTable.AcceptChanges.

This made the update go over 10000 rows/sec
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: VM | last post by:
I have a 35000 line datagrid and updating one field in all 35000 rows takes an eternity. How come? Since I don't have the datasource available (it may be a table or view), in my example I do it...
2
by: | last post by:
Hi all, Is it possible to update a selected row of a datatable ? I do not want to update the whole table just one maybe two at a time. Thank You.
1
by: Mike | last post by:
I have an ASP.NET/VB app that updates values in a DataTable over the course of about 3 different pages. On the way out of the first of these pages, I explicitly build the DataTable from values in...
1
by: Frank | last post by:
Hi, I have a datagrid based on a datatable. With two buttons users can move up or down the lines in the datagrid. What would be the best way to work: - update the datagrid cells (which are...
0
by: Roger | last post by:
I have a datagrid showing the following.... 3114 BUF 3/25/2005 A 3114 BUF 3/24/2005 A 3114 BUF 3/23/2005 B .. I have transposed this to Site Ext 3/25/2005 ...
1
by: Scott Emick | last post by:
I have the following datatables which are related: Transaction TransactionId-Sequence Orders OrderDetails when I process a daTransaction.update(dtTransaction)...
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...
4
by: pdh12783 | last post by:
Hi All, Language:-VB .NET Hi i am using the following method to retrieve values from the database.. DSRs.Tables(0).Rows(AbsolutePosition).Item(sFieldName) ...
3
by: newbtemple | last post by:
I keep getting index out of range errors when updating values in a datatable. Please see code below and offer any suggestions on a solution. In general, if the updates are slow, the datagridview...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.