Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing two data tables

Status
Not open for further replies.

zrefugee

Technical User
Jan 19, 2004
22
US
Does anyone know a way to find out if two data tables or data sets are different. I haven't been able to find a function that compares them.
 
What do you mean "comparing" tables? compare data?
In general, all objects have a method called "equals", but a table is a reference type, so equals returns true only if both references refer to the same object, and I assume this is not what you are looking for.
I don't think there is a function that does it.
You need to write it yourself, but you can make a table class that inherit from DataTable and override the equals method as you wish so your code will lokk nice (Don't forget to override the GetHashCode method).
If you want a challenge, make a general equals method that uses reflection to get all members of an instance and compare them to another instace members, but I don't think it worth.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top