|
-
Apr 9th, 2015, 01:05 PM
#1
Thread Starter
Addicted Member
Fastest way to compare two datatables?
I have two datatables. Each datatable contains 125 columns and about 30,000 rows. I currently am using the following method to compare them for differences:
01. DT1TableAdapter.Fill(DataSet1.DT1)
02. DT2TableAdapter.Fill(DataSet1.DT2)
03. BindingSource1.MoveFirst
04. BindingSource2.MoveFirst
05. Compare current row in BindingSource1 with current row in BindingSource2
06. If there are differences add the current two rows to a temporary datatable.
07. BindingSource2.MoveNext
08. Goto step 5 until end of BindingSource2 rows.
09. BindingSource1.MoveNext
10. Goto step 5 until end of BindingSource1 rows.
11. Print a report contains the different rows. (The report has the temporary datatable as a datasource.)
12. End
I have a fast PC and this method takes about 17 min to finish! Is that OK? if not, what is the fastest method to achieve the same goal?
Thanks
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|