Dataset.merge method

J

Jared

Hello all,
I am trying to merge a datarow (dataset, datatable, etc.) with values
from my database with another one that is filled with values from my active
directory database and merge the two together with the values from active
directory taking precedence. I have never used the merge method before and I
am having a bit of trouble.

I have two dataset objects
ds - dataset containing a single datatable object and a single row
ADds - same as ds

the schema is exactly the same as I have used ds.tables(0).clone to create
ADds' datatable and used the newrow function of ADds to populate my data
from AD.

This is where I'm having problems. I am currently using
ADds.Merge(ds,False), but the resulting dataset contains only the data from
ADds, can someone please point me in the right direction. I would prefer not
to loop through the datasets if at all possible, either way I would like to
know how the merge method is used (documentation only show the
missingschema.add variation). There is a primary key column set, and If
memory serves correctly, when I use the clone method my key column should
remain (which looks to be supported by the traces that I've run).

TIA,
Jared

Original DS Values (Database)
123456789
My messed up display name
Jared
MyLastName
Q
jared
jared
<null>
<null>

Merged DS Values (AD)
123456789
A good display name
Jared
AGoodLastName
<null>
Jared
(e-mail address removed)
987654321
555-1212

for a combined value of:

123456789
A good display name
Jared
AGoodLastName
Q
Jared
(e-mail address removed)
987654321
555-1212
 
G

Guest

The behavior of each row in the ds to be merged (the one between the parens,
not the 'owner' of the method) depends on the Row State. Unchanged, Modified
and Deleted are matched on primary keys. Added rows are simply added to the
table.
 
J

Jared

I see, it makes sense to have it based on the row state. Well guess it's
back to my for-in and if logic to merge the two datarows.
Thanks for putting this into perspective for me mklapp.
Jared
 

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