473,412 Members | 2,142 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,412 software developers and data experts.

.acceptchanges and updating to a database

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 5
tables which can be written to. During this accessing I have to delete some
records depending on certain criteria. I initially had some errors because I
wasn't accepting the changes made to the dataset. So using .acceptchanges
fixed the issue. however later on in the program a user may choose "update
changes to database" from the menu, this will only update any changes made to
the dataset after the last .acceptchanges command was issued.

Is there a way of updating the contents of the entire dataset to a database
instead of simply the changes made since the .acceptchanges command was
issued?

Cheers
Niels
Nov 21 '05 #1
2 1809
Niels,

The problem is that the rowstate of your row should be added to get what I
understand that you want.

http://msdn.microsoft.com/library/de...classtopic.asp

However AFAIK is the rowstate is readonly, which would mean that you should
in my opinion copy all tables and than really as new added rows.

I know that there are some problems which can be resolved with acceptchanges
while those problems should not exist.

Can you tell what that problem was?

Cor

"Niels Jensen" <Ni*********@discussions.microsoft.com>
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 5
tables which can be written to. During this accessing I have to delete
some
records depending on certain criteria. I initially had some errors
because I
wasn't accepting the changes made to the dataset. So using .acceptchanges
fixed the issue. however later on in the program a user may choose "update
changes to database" from the menu, this will only update any changes made
to
the dataset after the last .acceptchanges command was issued.

Is there a way of updating the contents of the entire dataset to a
database
instead of simply the changes made since the .acceptchanges command was
issued?

Cheers
Niels

Nov 21 '05 #2
Hmmm,

Sorry about the lack of responce - I found a way to sort out my problem by
seperating the tables being modified into their own Dataset. This stopped
the error being flagged.

Niels

"Cor Ligthert" wrote:
Niels,

The problem is that the rowstate of your row should be added to get what I
understand that you want.

http://msdn.microsoft.com/library/de...classtopic.asp

However AFAIK is the rowstate is readonly, which would mean that you should
in my opinion copy all tables and than really as new added rows.

I know that there are some problems which can be resolved with acceptchanges
while those problems should not exist.

Can you tell what that problem was?

Cor

"Niels Jensen" <Ni*********@discussions.microsoft.com>
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 5
tables which can be written to. During this accessing I have to delete
some
records depending on certain criteria. I initially had some errors
because I
wasn't accepting the changes made to the dataset. So using .acceptchanges
fixed the issue. however later on in the program a user may choose "update
changes to database" from the menu, this will only update any changes made
to
the dataset after the last .acceptchanges command was issued.

Is there a way of updating the contents of the entire dataset to a
database
instead of simply the changes made since the .acceptchanges command was
issued?

Cheers
Niels


Nov 21 '05 #3

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

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
8
by: Allan Bredahl | last post by:
Hi All I have a problem with getting a DataTable to submit changes back to the database when calling AcceptChanges. What I do is simplyfied this : 1) I set up a SqlDataAdapter with...
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. When changes are made to the data I use the...
1
by: Johann Blake | last post by:
I'm not sure that I entirely understand the purpose of the AcceptChanges methon in a DataView. I added a new record to a DataView and noticed that its RowState indicated it as being "Added". If I...
2
by: pushpendra vats | last post by:
Hi!!, I have created a dataadapter and datasdet through code .On button i have added two records in dataset and called acceptchanges method. on second button i am inserting the records in...
10
by: jaYPee | last post by:
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)...
3
by: Ryan Liu | last post by:
Hi, In the .NET Framework SDK documentation, I can see DataRow.AcceptChanges method will throw RowNotInTableException exeception. And in DataTable.AcceptChanges(), the documentation does not...
1
by: Andy B | last post by:
I have the following code: //delete the row in the table that has ID of 1. This line works fine. DataSet.Table.Rows.Find(1).Delete(); //Accept the delete changes to the table. This row returns...
2
by: Gurny | last post by:
I have a DataSet I am loading via the DataSet.Tables.Add() method. I call the AcceptChanges method on the DataTable first thing. Every thing looks good i.e. RowStates are all Unchanged. I then...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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
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...

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.