473,625 Members | 3,264 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Updates from a DataGridView

VB.NET 2005
SQL Server 2000

I have a datagridview that users will update. When there are only a
few records the update is fine. However when they update 100-200 of
the rows the udpate can take 2+ Mins.

Is this normal performance, as the datagridview was not meant to
update this many records at once?

Here is the code I am using to save the data:
<<Snip>>
Me.Validate()
Me.Spoc_ev_resu ltsBindingSourc e.EndEdit()
Dim iUpdate As Integer = _

Me.Spoc_ev_resu ltsTableAdapter .Update(Me.RCT_ EV_QADataSet.sp oc_ev_results)
<<Snip>>

Here is the Stored Procedure that gets called:
ALTER procedure [dbo].[spoc_ev_results _update]
@ItemID int,
@Status_ID int,
@UserID int,
@Notes varchar(1000) = NULL
AS

UPDATE dbo.t_EV_ExcepV al_Accts
SET
Status_ID = @Status_ID,
Notes = @Notes,
LastMaintBy_ID = @UserID,
LastMaintDate = getdate()
WHERE
ID = @ItemID
Jun 27 '08 #1
7 1806
Bill,

It seems that you do something terrible wrong, a dataadapter is updating
only updating (datasets, datatable, datarow(s)).

Those rows have all a rowstate which should be have not a value unchanged,
it seems to me that you are doing something where you ignore the rowstate.

Cor

"Bill Schanks" <ws******@gmail .comschreef in bericht
news:a3******** *************** ***********@p25 g2000hsf.google groups.com...
VB.NET 2005
SQL Server 2000

I have a datagridview that users will update. When there are only a
few records the update is fine. However when they update 100-200 of
the rows the udpate can take 2+ Mins.

Is this normal performance, as the datagridview was not meant to
update this many records at once?

Here is the code I am using to save the data:
<<Snip>>
Me.Validate()
Me.Spoc_ev_resu ltsBindingSourc e.EndEdit()
Dim iUpdate As Integer = _

Me.Spoc_ev_resu ltsTableAdapter .Update(Me.RCT_ EV_QADataSet.sp oc_ev_results)
<<Snip>>

Here is the Stored Procedure that gets called:
ALTER procedure [dbo].[spoc_ev_results _update]
@ItemID int,
@Status_ID int,
@UserID int,
@Notes varchar(1000) = NULL
AS

UPDATE dbo.t_EV_ExcepV al_Accts
SET
Status_ID = @Status_ID,
Notes = @Notes,
LastMaintBy_ID = @UserID,
LastMaintDate = getdate()
WHERE
ID = @ItemID
Jun 27 '08 #2
Well this might give you some extra performance

<<Snip>>
Me.Validate()
Me.Spoc_ev_resu ltsBindingSourc e.EndEdit()

if Me.RCT_EV_QADat aSet.spoc_ev_re sults.haschange s then
Dim iUpdate As Integer = _
Me.Spoc_ev_resu ltsTableAdapter .Update(Me.RCT_ EV_QADataSet.sp oc_ev_results.g etchanges)

end if
<<Snip>>

what this small change does
Only perform the update when there are changes in the rowset , if there are
updates only send the changed records

hth

Michel
"Bill Schanks" <ws******@gmail .comschreef in bericht
news:a3******** *************** ***********@p25 g2000hsf.google groups.com...
VB.NET 2005
SQL Server 2000

I have a datagridview that users will update. When there are only a
few records the update is fine. However when they update 100-200 of
the rows the udpate can take 2+ Mins.

Is this normal performance, as the datagridview was not meant to
update this many records at once?

Here is the code I am using to save the data:
<<Snip>>
Me.Validate()
Me.Spoc_ev_resu ltsBindingSourc e.EndEdit()
Dim iUpdate As Integer = _

Me.Spoc_ev_resu ltsTableAdapter .Update(Me.RCT_ EV_QADataSet.sp oc_ev_results)
<<Snip>>

Here is the Stored Procedure that gets called:
ALTER procedure [dbo].[spoc_ev_results _update]
@ItemID int,
@Status_ID int,
@UserID int,
@Notes varchar(1000) = NULL
AS

UPDATE dbo.t_EV_ExcepV al_Accts
SET
Status_ID = @Status_ID,
Notes = @Notes,
LastMaintBy_ID = @UserID,
LastMaintDate = getdate()
WHERE
ID = @ItemID

Jun 27 '08 #3
Michel,

As in past too thought that the get changes was needed, was this in my idea
a mistake from me.
The dataadapter itself is normaly only handling changed records.

In this case is at least a dataset.acceptc hanges needed, as the getchanges
is a copy of the set, and the rowstates in the origianl dataset are not
changed by this.

Cor

"Michel Posseth [MCP]" <MS**@posseth.c omschreef in bericht
news:OD******** ******@TK2MSFTN GP02.phx.gbl...
Well this might give you some extra performance

<<Snip>>
Me.Validate()
Me.Spoc_ev_resu ltsBindingSourc e.EndEdit()

if Me.RCT_EV_QADat aSet.spoc_ev_re sults.haschange s then
Dim iUpdate As Integer = _
Me.Spoc_ev_resu ltsTableAdapter .Update(Me.RCT_ EV_QADataSet.sp oc_ev_results.g etchanges)

end if
<<Snip>>

what this small change does
Only perform the update when there are changes in the rowset , if there
are updates only send the changed records

hth

Michel
"Bill Schanks" <ws******@gmail .comschreef in bericht
news:a3******** *************** ***********@p25 g2000hsf.google groups.com...
>VB.NET 2005
SQL Server 2000

I have a datagridview that users will update. When there are only a
few records the update is fine. However when they update 100-200 of
the rows the udpate can take 2+ Mins.

Is this normal performance, as the datagridview was not meant to
update this many records at once?

Here is the code I am using to save the data:
<<Snip>>
Me.Validate( )
Me.Spoc_ev_res ultsBindingSour ce.EndEdit()
Dim iUpdate As Integer = _

Me.Spoc_ev_res ultsTableAdapte r.Update(Me.RCT _EV_QADataSet.s poc_ev_results)
<<Snip>>

Here is the Stored Procedure that gets called:
ALTER procedure [dbo].[spoc_ev_results _update]
@ItemID int,
@Status_ID int,
@UserID int,
@Notes varchar(1000) = NULL
AS

UPDATE dbo.t_EV_ExcepV al_Accts
SET
Status_ID = @Status_ID,
Notes = @Notes,
LastMaintBy_ ID = @UserID,
LastMaintDat e = getdate()
WHERE
ID = @ItemID

Jun 27 '08 #4
Ok, it's only updating the rows that have changed. My problem is when
the user changes a lot of the rows (100-200 of them), then it takes a
long time to update.

The datagridview could have 800 records on it, but if they only change
2 of them everything is fine. My question is: Is it normal for it take
2+ Mins to update 200 rows?

On Jun 21, 9:22 am, "Cor Ligthert[MVP]" <notmyfirstn... @planet.nl>
wrote:
Michel,

As in past too thought that the get changes was needed, was this in my idea
a mistake from me.
The dataadapter itself is normaly only handling changed records.

In this case is at least a dataset.acceptc hanges needed, as the getchanges
is a copy of the set, and the rowstates in the origianl dataset are not
changed by this.

Cor

"Michel Posseth [MCP]" <M...@posseth.c omschreef in berichtnews:OD* *************@T K2MSFTNGP02.phx .gbl...
Well this might give you some extra performance
<<Snip>>
Me.Validate()
Me.Spoc_ev_resu ltsBindingSourc e.EndEdit()
if Me.RCT_EV_QADat aSet.spoc_ev_re sults.haschange s then
Dim iUpdate As Integer = _
Me.Spoc_ev_resu ltsTableAdapter .Update(Me.RCT_ EV_QADataSet.sp oc_ev_results.g etchanges)
end if
<<Snip>>
what this small change does
Only perform the update when there are changes in the rowset , if there
are updates only send the changed records
hth
Michel
"Bill Schanks" <wscha...@gmail .comschreef in bericht
news:a3******** *************** ***********@p25 g2000hsf.google groups.com...
VB.NET 2005
SQL Server 2000
I have a datagridview that users will update. When there are only a
few records the update is fine. However when they update 100-200 of
the rows the udpate can take 2+ Mins.
Is this normal performance, as the datagridview was not meant to
update this many records at once?
Here is the code I am using to save the data:
<<Snip>>
Me.Validate()
Me.Spoc_ev_resu ltsBindingSourc e.EndEdit()
Dim iUpdate As Integer = _
Me.Spoc_ev_resu ltsTableAdapter .Update(Me.RCT_ EV_QADataSet.sp oc_ev_results)
<<Snip>>
Here is the Stored Procedure that gets called:
ALTER procedure [dbo].[spoc_ev_results _update]
@ItemID int,
@Status_ID int,
@UserID int,
@Notes varchar(1000) = NULL
AS
UPDATE dbo.t_EV_ExcepV al_Accts
SET
Status_ID = @Status_ID,
Notes = @Notes,
LastMaintBy_ID = @UserID,
LastMaintDate = getdate()
WHERE
ID = @ItemID
Jun 27 '08 #5
Bill Schanks wrote:
Ok, it's only updating the rows that have changed. My problem is when
the user changes a lot of the rows (100-200 of them), then it takes a
long time to update.

The datagridview could have 800 records on it, but if they only change
2 of them everything is fine. My question is: Is it normal for it take
2+ Mins to update 200 rows?
I would say no. I would also say that the datagridview (or any other control you
might use) has nothing to do with it. The update process goes from the datatable
to the backend database, regardless of how the data in the table got changed.

You are presumably updating one row at a time, with a separate round trip for
each row. That may be the source of slowness, depending on the network and the
database server and the connection. Anything you can do to send all of the
updates at the same time would help.
Jun 27 '08 #6
Yea, I think the slowless is from the multiple round trips. How would
I go about doing one round trip? Say I have 100 Updates on the grid.
How would I update multiple rows with different values with one update
statement?

On Jun 21, 8:02 pm, "Steve Gerrard" <mynameh...@com cast.netwrote:
Bill Schanks wrote:
Ok, it's only updating the rows that have changed. My problem is when
the user changes a lot of the rows (100-200 of them), then it takes a
long time to update.
The datagridview could have 800 records on it, but if they only change
2 of them everything is fine. My question is: Is it normal for it take
2+ Mins to update 200 rows?

I would say no. I would also say that the datagridview (or any other control you
might use) has nothing to do with it. The update process goes from the datatable
to the backend database, regardless of how the data in the table got changed.

You are presumably updating one row at a time, with a separate round trip for
each row. That may be the source of slowness, depending on the network and the
database server and the connection. Anything you can do to send all of the
updates at the same time would help.
Jun 27 '08 #7
Bill Schanks wrote:
Yea, I think the slowness is from the multiple round trips. How would
I go about doing one round trip? Say I have 100 Updates on the grid.
How would I update multiple rows with different values with one update
statement?
Here's some reading:

http://msdn.microsoft.com/en-us/library/aadf8fk2.aspx

http://devcenter.infragistics.com/Su...ArticleID=8270

http://www.asp.net/learn/data-access...ial-63-cs.aspx

HTH
Jun 27 '08 #8

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

Similar topics

0
3602
by: DraguVaso | last post by:
Hi, I'm using the DataGridView in VB.NET 2.0. The DataSource is a Generic List of a custom class0: lstMyPersonnes = New List(Of clsPersonne). When I add a new clsPersonne to lstMyPersonnes, and rebind the lstMyPersonnes to my DataGridView.dataSource, it shows the new record in the DataGridView as it should be. But when I click on a cell of that row, I suddenly got this error: "Index -1
10
39471
by: Henok Girma | last post by:
Hello Gurus, I want to save the state of an unbound DataGridView on my Windows Form application to an XML file so i can later load it back.. Basically, on my form I have a DataGridView, it's got some DataGridViewTextBoxCell, DataGridViewComboBoxCell etc, i want to export all that to XML.. Any help is greatly appreciated.
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...
2
24532
by: bob | last post by:
Can anyone tell me the best way to update a dataset while it is being edited/viewed in the DataGridView control? Is this something that should be inserted into one of the grid's events? or should you update after closing the grid/form, etc.? Also, can you tell me the best book to buy that fully explains the DataGridView control? Thanks.
7
12595
by: Mitchell S. Honnert | last post by:
Is there an equivalent of the DataGrid's DataGridTableStyle for the DataGridView? If not, is there an easy way to duplicate the DataGridTableStyle's functionality for the DataGridView? Here's the background for my question... Before I switched my application over to the Fx 2.0, I used a DataGrid to display my data. I would store different DataGridTableStyles (each one with a custom set of columns) in the DataGrid.TableStyles property...
0
2498
by: jeastman - Hotmail | last post by:
Hello world Excuse, not to be written English and it helps me with a translator. I am new programming in C#. I made a control inheriting the DataGridView to be able to add controls done by my.
2
2373
by: =?Utf-8?B?anVsaW8=?= | last post by:
I am trying to use Update to save changes made on two DataGridView's to two tables (Posts & PostDetails) with a FK relationship. I say private void bUpdate_Click(object sender, EventArgs e) { try { CustomerDataSetTableAdapters.TableAdapterManager taManager = new CustomerDataSetTableAdapters.TableAdapterManager(); taManager.PostsTableAdapter = postsTableAdapter; taManager.PostDetailsTableAdapter = postDetailsTableAdapter;
3
5730
by: Andrus | last post by:
I have DataGridView in virtual mode containing 3500 rows. In code below, assigning to RowCount value to 3500 takes 8 seconds. CPU usage goes high at this time. Stepping by F11 into user code shows few celltemplate property getters and combobox/datecombo constructor calls without database access which does not take a lot of time. Debug output (below) shows lot of messages Stepping over non-user code. Running in release mode from...
0
5644
by: priyamtheone | last post by:
I'm trying to make a datagridview column to act like a datetimepicker column (C#.Net 2005). These are the behaviours that the dgv should have: 1) Initially all the cells of the dtp column should be blank unless they are filled by the user. 2) As soon as the user enters a cell, the dtp control should appear as the editing control of that cell. If there's a value in the cell beforehand, that value is set as the value of the dtp editing control...
0
8189
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8694
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...
0
8635
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8356
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,...
1
6118
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
5570
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
4089
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
4193
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.