Merge and Get Changes returns nothing

J

Joseph Byrns

I have a simple case of two datasets each containing a table with the same
schema. When I merge the two datasets, the empty tables in daataset1 get
filled with the rows from dataset2, all fine so far. When I try and get the
changes of the tables in dataset1 no changes are returned. Any ideas?

''merge the server table with the local table
ds_Server.Merge(ds_Local)
ds_Server.Table(0-x) all have rows now,
but ds_Server.Table(0-x).GetChanges returns nothing.
 
C

Cor Ligthert [MVP]

Joseph,

Because you merge complete rows, not items.

The datarowstates stay the same, it is not a kind of selective merge as you
have maybe the idea about..

It merges all, where the rows with the same key are replaced and the ones
with not a same key in the called table are added to the caller.

I hope this helps,

Cor
 
J

Joseph Byrns

So what is the cure, do I have to go through each row and change the
rowstate to modified and inserted as appropriate?
 
C

Cor Ligthert [MVP]

Joseph,

Normally they have a changed rowstate in advance, however why that is not,
is something I cannot see from this message thread. Do you use by instance
somewhere acceptchanges in advance?

Cor
 
J

Joseph Byrns

No, I get data from a local database (based on a primary key GUID) then I
get data from a server database (based on the same GUID), then I merge the
local dataset to the server dataset, none of the rows that get inserted have
any rowstate other than unmodified.
 
C

Cor Ligthert [MVP]

Joseph,
No, I get data from a local database (based on a primary key GUID) then I
get data from a server database (based on the same GUID), then I merge the
local dataset to the server dataset, none of the rows that get inserted
have any rowstate other than unmodified.
Than the merged rows have as well a rowchange unmodified. However, this will
probably help you when you use it on the local(I assume this) fill.

http://msdn.microsoft.com/library/d...aadapterclassacceptchangesduringfilltopic.asp

I hope this helps,

Cor
 
J

Joseph Byrns

Excellent, I set AcceptChangesDuringFill to false for the local database and
everything now seems to work fine.

Thanks.
 

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