DataSet.Merge yielding Constraint Error

G

Guest

I have dataset1, do a GetChanges to yield dataset2
dataset2 is saved
The keys from dataset2 are used as search parameters to retrieve new data
into dataset3.

dataset1's DataRowState (the test row) is Modified
dataset3's DataRowState is Unchanged
It's a simple update, so all of the primary key values are there (Original,
Current, etc.)

dataset3 is returned and then I attempt to merged into dataset1 - and I get
Constraint Error. Looking in the watch window I see that dataset3's rows are
being added to dataset1 and this thus leads to a Constraint Error. Why
aren't the values being "merged" based on primary key?
 
G

Guest

I found the problem: The DataColumn was not set as the PrimaryKey property
of the DataTable. Before merge, I looped thru the tables and made sure the
primary key was added. Problem solved...
 

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