Dataset Merging

C

Chris Smith

Experienced Posters,

Couple of questions if you have time please.

Question 1
I have 2 tables in my db, the schema is exactly the same in each table.
There is only one record in each table. The one record in each table is
exactly the same. as well

Part Table with 1 record
ID = 1
UOM = EA
QTY = 40

Part Table 2 with 1 record
ID = 1
UOM = CT
QTY = 40

I pull these tables into 2 separate datatables, and create a dataset object.
At this point I add the first table using ds.tables.add table1. Then I merge
using ds.merge(table2, true, MissingSchemaAction.Add)

Now I have reviewed the merge documentation, and It says table is merged
into "current" table. What is the current table of a dataset object?????
Because if I add table1 to the dataset first, it should be the original, so
if I set the rowviewstate filter to modified original i should see UOM = EA,
but I see CT????? Not sure what is going on there.

Question 2.

Same tables, same data
Part Table with 1 record
ID = 1
UOM = EA
QTY = 40

Part Table 2 with 1 record
ID = 1
UOM = EA
QTY = 40

When I merge 2 datatables here I would expect to see 1 row, with a rowstate
of .unchanged, but I see 1 row with rowstate of modified.... If it was
modified during the merge, I don't see where?

Can anyone help me out with this one?

Thanks

Chris Smith
 
C

Chris Smith

Oh, I didn't state that there ARE primary keys on the ID fields in these
tables. I have read that the PK is used during the merge.
 
W

W.G. Ryan eMVP

Chris:

I take it your first problem is solved. Regarding the second one, have you
verified HasChanges/ or the rowstate or each before the merge? That may
well be where the modification is coming from.
 

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