473,626 Members | 3,276 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGridView + DataTable Speed

Hello,
When I create a DataTable and add 10000 rows my computer needs about
20ms. To delete 10000 rows it needs about 15ms.

When I connect the DataTable to a DataGridView it needs 3100ms to add
10000 rows and 6300ms to delete 10000 rows. That might be ok because
the control needs an update.

But when a disconnect the DataTable widht dgv.DataSoure = null it
needs 420ms to add 10000 rows and 2430ms to delete rows.

Can anyone explain what happened here and how I can modify the
DataTable so I get the performance when it is never bound to a
DataGridView?

Thanks in advance for any response

Azraiyl
Jan 14 '08 #1
3 5809
Well, how did you bind it to the dgv? Was there a BindingSource
involved? Either way, controls (such as dgv) generally also speak to a
CurrencyManager via their BindingContext, so it is quite possible that
until you kill the form, that the ctx is still talking to the form
[but without any UI to redraw any more, hence not as slow]; the
BindingContext keeps a reference to the source as currency is shared
between alike sources.

Marc
Jan 14 '08 #2
Hi,

You need to provide more details, like if this is a win or a web based app.
In any case 10K of rows are a little too much, you should reduce the number
of rows. That will improve the performance al ot.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
<az*****@gmail. comwrote in message
news:4e******** *************** ***********@i29 g2000prf.google groups.com...
Hello,
When I create a DataTable and add 10000 rows my computer needs about
20ms. To delete 10000 rows it needs about 15ms.

When I connect the DataTable to a DataGridView it needs 3100ms to add
10000 rows and 6300ms to delete 10000 rows. That might be ok because
the control needs an update.

But when a disconnect the DataTable widht dgv.DataSoure = null it
needs 420ms to add 10000 rows and 2430ms to delete rows.

Can anyone explain what happened here and how I can modify the
DataTable so I get the performance when it is never bound to a
DataGridView?

Thanks in advance for any response

Azraiyl

Jan 14 '08 #3
@Marc Gravell

I did bind it with "dgv.DataSo urce = dt". Thanks for your information
about this CurrencyManager , have first to google about it.

@Ignacio Machin

It doesn't matter if i add 1000 or 10000 rows, after binding the
insert/delete operations are slow, before binding insert/delete
operations are fast. It is a windows application.
Jan 15 '08 #4

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

Similar topics

1
3152
by: sapkal.manish | last post by:
Question : How can I find actual row position of DataTable in DataGridView when DataTable is sorted / My source code like this Private WithEvent dgvInwDet as new DataGridView Private WithEvent DataTable as New DataTable
3
32261
by: Rich | last post by:
Hello, I am populating a datagridview from a datatable and filtering the number of rows with a dataview object. Is there a way to retrieve the rows displayed by the datagridview into a separate datatable without having to loop through each column in the datagridview? Or is there a way to retrieve the rows from the original datatable filtered by the dataview into a separate table? I only want to copy the rows from the main table that...
1
3725
by: George | last post by:
Hi, I have a DataGridView, bounded to a DataTable which is populated/updated by a OleDbDataAdapter (with OleDbConnection) to an Access Database. (Sounds familiar to some of you ... I have posted a number of related questions already.) I want to have a worker thread starting to consume data from the DataTable. Imagine that the DataTable contains a list of tasks. From the C# .NET specification, DataTable "is safe for multithreaded...
3
2479
by: Mike | last post by:
Dear group, I'm currrently investigating a bug within a piece of our software whereby if a DataGridView (bound directly to a DataTable) is ordered by column headers (containing lookup combo boxes where the value is the foreign key of another table), although the DataGridView is ok, the DataTable becomes out of sync. In other words, I have a Grid of customers, and if a customer name column header is clicked - the data moves in the...
3
94241
by: sklett | last post by:
I'm changing from a DataGrid to a DataGridView and have run across a problem. The items that are bound to the DataGrid have an int Property that represents a primary key of a lookup table in my database. For example: table JobTypes 1 | Manager 2 | Controller 3 | Supervisor table Employee
5
7148
by: DanThMan | last post by:
The situation: * I have a ButtonColumn in a DataGridView. * When the user preses one of the buttons, a dialog appears. * Based on what the user selects in the dialog, data is entered programmatically into the the underlying cell (i.e., I'm setting Value property of the cell based on user input, but the user is not directly entering any data). The problem:
2
15525
by: Steve Richter | last post by:
what is the best way to use DataGridView to view data from large database tables? Where the sql select statement might return millions of rows? string connectionString = GetFinancesConnString(); string sqlSelect = "select CheckNbr, CheckDate, CheckAmt from Disbursements" ; SqlDataAdapter adapter = new SqlDataAdapter(sqlSelect, connectionString);
0
1167
by: Chris | last post by:
I have a DataGridView in a form that will display the information from various DataTables in my DataSet. The user is provided a list of tables and when they select a table name, the DataGridView displays the appropriate DataTable. When a user changes some of the settings in my program, I sometimes have to recreate some of the DataTables, however, the DataGridView will still somehow display the original DataTable even if the DataGridView...
3
8532
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I'm trying to add a datagridview control to a Windows Form to display read-only information in visual basic 2005. My understanding is that datareader will be faster for this purpose. I have the following questions: 1. Can DataReader be bound DIRECTLY to DataGridView? 2. If DataReader cannot be bound directly to DataGridView, how can I load a DataReader into a DataTable and bind the DataTable to DataGridView? Can the DataTable be a...
0
8269
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8711
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8368
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7203
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5576
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4094
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4206
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.