comparing DataSets?

L

Leon_Amirreza

dataset1.table1 is filled from a table in a database
dataset2.table1 is filled from a table in a database

How can I programatically compare the two tables to see if their schemas are
compatible (Same column definitions and contraints and keys...) and can be
merged or not?
 
A

Alvin Bruney [MVP]

Perhaps the easiest and cheapest way is to perform the merge. If the schemas
are the same, all is well. Otherwise, they are not and you will get an
exception that you can handle appropriately.
 
J

Jani Järvinen [MVP]

Hello!
Perhaps the easiest and cheapest way is to perform the merge. If the
schemas are the same, all is well.

I agree with Alvin, this is probably the easiest way to proceed. However,
depending on your needs, the ConstraintException that is raised (in case of
schema mismatch) might not give you enough details what's different in the
schemas.

Then, the remedy would be to loop through the elements in the Table.Columns
collection, and after that check for example primary keys, etc.

Hope this helps!

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
(e-mail address removed)
http://www.saunalahti.fi/janij/
 

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