views:

48

answers:

3
+1  Q: 

Compare Datatables

Is there any way that I can compare 2 datatables with each other, both will have the same columns but I would like to check the rows in them to see which ones exist and which ones don't in each of the tables, is there an elegant way to do this?

I am using c# ASP.NET too.

Thanks in advance, hope I have explained it well enough.

+1  A: 

Hi Coesy, Try this product, I've used it in the past and its great for this kind of thing. There is a free 14 day trial so might be what you are after.

http://www.red-gate.com/products/SQL_Compare/

Cheers Tigger

Tigger
I think he wants to compare datatables rather than database tables, unless this can do that too?
w69rdy
Sorry i miss-read the question - try this link for what your after. http://kseesharp.blogspot.com/2007/12/compare-2-datatables-and-return-3rd.html
Tigger
+2  A: 

Hi,

Refer this..

http://forums.asp.net/t/1541581.aspx

http://stackoverflow.com/questions/164144/c-how-to-compare-two-datatables-a-b-how-to-show-rows-which-are-in-b-but-not

Geetha
Thanks, it was more "doing it programatically" I was looking for than actual SQL Compare type software, cheers folks.
Coesy
A: 

For comparing the schema of the database, SQL Compare is great.

If what you are comparing is the data, you can use SQL Data Compare, another product from Red Gate:

http://www.red-gate.com/products/SQL_Data_Compare/

I have been using these products for about 4 years and they are almost a complete replacement for a DBA. They work great for deploying databases and data from DEV>TEST>PROD or for making live backups for testing against.

The best part is you never have to worry if something is different between your staging and production environment - this tool will find and fix nearly any difference.

Full Disclosure: I don't work for Red Gate, I am a happy customer.

NightOwl888