472,353 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

very slow when updating dataset using AcceptChanges

does anyone experienced slowness when updating a dataset using
AcceptChanges?

when calling this code it takes many seconds to update the database

SqlDataAdapter1.Update(DsStudentCourse1)
DsStudentCourse1.AcceptChanges()

i'm also wondering because w/ out AcceptChanges the data is still save
into the database and it is now faster.

thanks in advance for any info.
Nov 20 '05 #1
10 5421
From MSDN:

When using Update, the order of execution is as follows:
1.The values in the DataRow are moved to the parameter values.
2.The OnRowUpdating event is raised.
3.The command executes.
4.If the command is set to FirstReturnedRecord, then the first returned
result is placed in the DataRow.
6.If there are output parameters, they are placed in the DataRow.
7.The OnRowUpdated event is raised.
8.AcceptChanges is called.

So don't need to call explicitly AcceptChanges because the Update method
already does this.
Ernest


"jaYPee" <hi******@yahoo.com> wrote in message
news:33********************************@4ax.com...
does anyone experienced slowness when updating a dataset using
AcceptChanges?

when calling this code it takes many seconds to update the database

SqlDataAdapter1.Update(DsStudentCourse1)
DsStudentCourse1.AcceptChanges()

i'm also wondering because w/ out AcceptChanges the data is still save
into the database and it is now faster.

thanks in advance for any info.

Nov 20 '05 #2
Thank you very much for the reply. however i have this scenario that
if i don't use AcceptChanges the record in the datagrid (which
contains related table) is not showing

this is the scenario:

i have a parent/child form that after clicking a checkbox in the
parent form the program will execute the stored procedure from sql
server 2000 then save the data in the related table that is based on
the criteria from the primary table and filling the datagrid (which
contains related table)

but i can't see the changes after clicking the checkbox if i don't use
AcceptChanges after an update.

thanks again for any info.

On Fri, 11 Jun 2004 10:21:15 +0200, "Ernest Morariu"
<er****@gesora.com> wrote:
From MSDN:

When using Update, the order of execution is as follows:
1.The values in the DataRow are moved to the parameter values.
2.The OnRowUpdating event is raised.
3.The command executes.
4.If the command is set to FirstReturnedRecord, then the first returned
result is placed in the DataRow.
6.If there are output parameters, they are placed in the DataRow.
7.The OnRowUpdated event is raised.
8.AcceptChanges is called.

So don't need to call explicitly AcceptChanges because the Update method
already does this.
Ernest


"jaYPee" <hi******@yahoo.com> wrote in message
news:33********************************@4ax.com.. .
does anyone experienced slowness when updating a dataset using
AcceptChanges?

when calling this code it takes many seconds to update the database

SqlDataAdapter1.Update(DsStudentCourse1)
DsStudentCourse1.AcceptChanges()

i'm also wondering because w/ out AcceptChanges the data is still save
into the database and it is now faster.

thanks in advance for any info.


Nov 20 '05 #3
Hi jaYPee,

I have seen this as well, it is a weird scenario. Confirming to the
documentation this should not be necessary, however it is, it seems in my
eyes something with the datasource and not with the datagrid.

There was a kind of the same message from Herfried yesterday about an
arraylist.

Cor

this is the scenario:

i have a parent/child form that after clicking a checkbox in the
parent form the program will execute the stored procedure from sql
server 2000 then save the data in the related table that is based on
the criteria from the primary table and filling the datagrid (which
contains related table)

but i can't see the changes after clicking the checkbox if i don't use
AcceptChanges after an update.

Nov 20 '05 #4
not with the datatable
Nov 20 '05 #5
jayYPee,
Do you have a sample app that identifies this problem.

Are you updating both the Parent & the Child? Are you updating the tables in
the correct order? Are you updating rows in the correct order? (for possible
issues on updating in the correct order see Sceppa's book below).

As Ernest & Cor have stated, calling AcceptChanges after Update should not
be needed, as Update does call AcceptChanges!

You may have stumbled on a bug in the framework (either the dataset or the
datagrid), hence my asking if you have a sample that identifies the problem.
Especially if you can consistently recreate it.

For a good tutorial on ADO.NET as well as a good desk reference once you
know ADO.NET see David Sceppa's book "Microsoft ADO.NET - Core Reference"
from MS press.

Hope this helps
Jay
"jaYPee" <hi******@yahoo.com> wrote in message
news:ov********************************@4ax.com...
Thank you very much for the reply. however i have this scenario that
if i don't use AcceptChanges the record in the datagrid (which
contains related table) is not showing

this is the scenario:

i have a parent/child form that after clicking a checkbox in the
parent form the program will execute the stored procedure from sql
server 2000 then save the data in the related table that is based on
the criteria from the primary table and filling the datagrid (which
contains related table)

but i can't see the changes after clicking the checkbox if i don't use
AcceptChanges after an update.

thanks again for any info.

On Fri, 11 Jun 2004 10:21:15 +0200, "Ernest Morariu"
<er****@gesora.com> wrote:
From MSDN:

When using Update, the order of execution is as follows:
1.The values in the DataRow are moved to the parameter values.
2.The OnRowUpdating event is raised.
3.The command executes.
4.If the command is set to FirstReturnedRecord, then the first returned
result is placed in the DataRow.
6.If there are output parameters, they are placed in the DataRow.
7.The OnRowUpdated event is raised.
8.AcceptChanges is called.

So don't need to call explicitly AcceptChanges because the Update method
already does this.
Ernest


"jaYPee" <hi******@yahoo.com> wrote in message
news:33********************************@4ax.com.. .
does anyone experienced slowness when updating a dataset using
AcceptChanges?

when calling this code it takes many seconds to update the database

SqlDataAdapter1.Update(DsStudentCourse1)
DsStudentCourse1.AcceptChanges()

i'm also wondering because w/ out AcceptChanges the data is still save
into the database and it is now faster.

thanks in advance for any info.

Nov 20 '05 #6
Hi Jay,

I have already made an very simple sample not this problem however it looks
as this and sended it to the ADONET group in a discussion, however the
thread stopped after I had send it.

Are you interested?

Cor
Nov 20 '05 #7
On Fri, 11 Jun 2004 16:02:05 +0200, "Cor Ligthert"
<no**********@planet.nl> wrote:
Hi Jay,

I have already made an very simple sample not this problem however it looks
as this and sended it to the ADONET group in a discussion, however the
thread stopped after I had send it.

Are you interested?

Cor


yes i'm interested
Nov 20 '05 #8
Hi jaYpee,

Whith that sample I show the behaviour that you tell.

(It has to do with the position of a row in a datagrid)

With acceptchanges it is after an insert on the right place, while it is
whithout that at the end.

However for me a kind of same behaviour, as you tell.

(Adding rows in a datagrid and doing an acceptchanges after that is useless
of course, this for the ones who maybe will google this thread onces)

However the sample gives no solution.

Sorry

Cor
Nov 20 '05 #9
Cor,
Can you either post the code or email me it (a linke would work as well). I
don't really have time right now to search the ado group for it.

Thanks
Jay

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:eO**************@TK2MSFTNGP10.phx.gbl...
Hi jaYpee,

Whith that sample I show the behaviour that you tell.

(It has to do with the position of a row in a datagrid)

With acceptchanges it is after an insert on the right place, while it is
whithout that at the end.

However for me a kind of same behaviour, as you tell.

(Adding rows in a datagrid and doing an acceptchanges after that is useless of course, this for the ones who maybe will google this thread onces)

However the sample gives no solution.

Sorry

Cor

Nov 20 '05 #10
Jay,

This is one from the test I did, I also did it with SetDatabinding (when you
want that, it was even smaller, reply than) the result was almost the same
however more difficult to explain.

You see in this sample not the acceptchanges however when that is done with
everything enabled the rows are as well presented in the way as what it in
my opinion should be.

Maybe you find why this behaviour is, I could not find one "logical" clue.

Cor
It needs only a form with a datagrid and this in the loadform event. After
that you have to delete the two ' , to show what I mean.

\\\
Dim ds As New DataSet
Dim dt As New DataTable("Bill")
ds.Tables.Add(dt)
dt.Columns.Add("Ryan")
For i As Integer = i To 3
dt.Rows.Add(dt.NewRow)
dt.Rows.Item(i)(0) = i.ToString
Next
'DataGrid1.DataSource = dt
'with above endabled the datagrid shows 0 1 2 3 4
'DataGrid1.DataSource = Nothing
'now with these two rows disabled it displays 0 1 4 2 3
Dim dr As DataRow = dt.NewRow
dr(0) = "4"
dt.Rows.InsertAt(dr, 2)
DataGrid1.DataSource = dt
///
Nov 20 '05 #11

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

Similar topics

9
by: Bill Salling | last post by:
am trying to updated the source data(Access2000) for my data grid. But keep getting this error An unhandled exception of type...
0
by: Steve Amey | last post by:
Hi all I have a form with some data bound to it. There is a list on the form that could display any number of records that the user requests. ...
6
by: foobar | last post by:
Okay, I have created a Customers class. This class allows a user to select and update the customers table on an Sql Server database. I can...
11
by: tomp | last post by:
Hi, I am trying to insert a row into the Categories Table in Nothwinds database in MSDE. I am able to manually insert it using a query tool. ...
1
by: Kai Thorsrud | last post by:
Hi, I've only got a typical crappy Microsoft book about ADO.NET (MSPRESS !"(¤#&/()&¤# you for mixing manual written code and suddenly adding...
14
by: Lars Netzel | last post by:
A little background: I use three Datagrids that are in a child parent relation. I Use Negative Autoincrement on the the DataTables and that's...
2
by: Niels Jensen | last post by:
I have a some code which imports information from a text file to a dataset. Depending op what is being extracted from the text file, the dataset has...
6
by: mike11d11 | last post by:
I'm trying to create an application that will have multiple users working off a table on a SQL server. Since multi users will be updating...
1
by: jonbartlam | last post by:
Hi There I'm not sure what exactly is going wrong here. I'm writing an application that retreives a table from a database (tbl_internalfaults) and...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.