DataBase doesn't AcceptChange

G

Guest

HI
I'm trying to copy schema and data from a dataset to another, using DataSet.Merge method
The 2 dataset are filled by 2 adapters and the sources are 2 mdb database
When i merge datasets, it looks like the destination dataset takes the schema, but after the AcceptChanges method I can't see any change in the MDB database
What i'm missing
Code follows

DataSet1.Merge(DataSet2,true, System.Data.MissingSchemaAction.Add)
OleAdapter.Update(DatSet1,"Bookings")
DataSet1.AcceptChanges()


Thank yo
Fabrizio
 
W

William Ryan eMVP

AcceptChanges doesn't send anything or do anything to the MDB file, it
merely changes the rowstate of the rows in your dataset so the DataAdapter
can make a determination whether or not to send those changes when/if Update
is ever called.

If you insert Debug.Assert(DataSet1.HasChanges) before you call update, I'm
guessing it will appear false. If the changes aren't taking, either your
update logic is failing (not necessarily raising an exception, but not
working as expected or the dataadapter isn't seeing any changes)j. If you
don't have any changes, call Update till the cows come home and nothing is
going to happen to your db. Similarly, AcceptChanges only concerns itself
directly with the local state of the dataset and is completely unrelated to
the backend (except that if you call it BEFORE you call update, your
rowstates won't be changed and nothing will get sent back to the db.).

Check out this article http://www.knowdotnet.com/articles/datasetmerge.html
It may be helpful.

HTH,

Bill
Fabrizio said:
HI,
I'm trying to copy schema and data from a dataset to another, using DataSet.Merge method.
The 2 dataset are filled by 2 adapters and the sources are 2 mdb database.
When i merge datasets, it looks like the destination dataset takes the
schema, but after the AcceptChanges method I can't see any change in the MDB
database.
 
I

Ismail Rajput

==============================================
you need to change the order

first
DataSet1.AcceptChanges();

then

OleAdapter.Update(DatSet1,"Bookings");

===============================================
Fabrizio said:
HI,
I'm trying to copy schema and data from a dataset to another, using DataSet.Merge method.
The 2 dataset are filled by 2 adapters and the sources are 2 mdb database.
When i merge datasets, it looks like the destination dataset takes the
schema, but after the AcceptChanges method I can't see any change in the MDB
database.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top