Dataset Merging

  • Thread starter Thread starter Chris Smith
  • Start date Start date
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
 
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.
 
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.
 
Back
Top