mergE 2 datasets, no duplicates ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello
i have 2 data sets and i only want to put the data from ds2 into ds1 that
isn't in ds1 already,
i used merge but that just appended the whole ds2 into ds1, is there a way
to just append the ones that don't alreadyexist in ds1.


thank you
 
GATMAN said:
hello
i have 2 data sets and i only want to put the data from ds2 into ds1 that
isn't in ds1 already,
i used merge but that just appended the whole ds2 into ds1, is there a way
to just append the ones that don't alreadyexist in ds1.

Does the DataTable have a key? If not how do you expect to identify
duplicates.

David
 
hello

Question RESOLVED

I found out how to only add the unique data.

In order for the Merge method to be able to compare rows based on the
primary key, the key information must be defined for the DataSet, this can be
done by setting the MissingSchemaAction property of the data adapter used to
fill the DataSet to AddWithKey.
ex.
da = New OleDbDataAdapter(comm)
da.MissingSchemaAction = MissingSchemaAction.AddWithKey
da.Fill(Temp_ds, MainTable.ToString)
 
Back
Top