Comparing two typed datasets

  • Thread starter Thread starter Cowboy
  • Start date Start date
C

Cowboy

The fact the datasets are typed means you can compare schemas rather easily,
but little else. You can loop through the records and determine the
differences. There are a couple of ways to handle data differences.

1. Loop through the records in one and compare to the same row in the other.
Slow but thorough.
2. Compare the data as XML. A bit faster, but can be error prone if you make
mistakes.
3. Link the data sources (not always possible) and grab the delta between
the two (ie, only those records that are different). From here you can loop
through and update those records incorrect in one data source (the one that
fills tdsEmp2).

Without understanding the goal, I can only suggest generic ideas, but this
should give you a start.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
 
Hi,
I have a typed dataset for Employee named tdsEmployee.
tdsEmployee has two columns named FirstName, LastName

I want to compare two instances of tdsEmployee and get the differences.

For Ex:
tdsEmp1 might have data like
Row1: 'Mike', 'Meyers'
Row2: 'John', 'Doe'

tdsEmp2 might have data like
Row1: 'Mike', 'Meyers'
Row2: 'John', 'Abe'

Then after comparision, I want the result : 'John', 'Doe'

is there any way to do this ??

TIA. :)
 
Hi,

When I did similar staff I used relations between two datatables. Since
there is no direct way to join tables, I set relation and looped through the
one datatable. Inside a loop I selected all the children in a related table
and then did my staff based on a situation. But this way has one
limitation - parent table should have primary key.
Another possible way is to create helper class, similar to what is in next
KB

http://support.microsoft.com/default.aspx?scid=kb;en-us;325688
 
Could you explain a bit more on the third point i.e. grab the delta. That is
exactly what i want to do.

TIA :)
 
Hi Val,
Thanx for the suggestion. But, my problem is checking for data of the master
table itself

TIA :)
 
Back
Top