Compare disparate data using C#

S

scarpacci

Hi Gurus,

A colleague receive data via an XML file from a vendor. We want to
compare the data in that file with what is in our db (it is an
inventory feed). Currently we pull the db inventory table into a
DataTable and also pull the xml file into a DataTable and use LINQ to
compare/find deltas. Our other option was to stage the data in a DB
table and do comparisons within SQL.

Any other thoughts/ideas on how to approach this situation?

Thanks,

S
 
M

Mr. Arnold

scarpacci said:
Hi Gurus,

A colleague receive data via an XML file from a vendor. We want to
compare the data in that file with what is in our db (it is an
inventory feed). Currently we pull the db inventory table into a
DataTable and also pull the xml file into a DataTable and use LINQ to
compare/find deltas. Our other option was to stage the data in a DB
table and do comparisons within SQL.

Any other thoughts/ideas on how to approach this situation?

Using Linq is a good approach, but querying a DataTable is not so good,
which should be done with a collection List<T>.


http://msdn.microsoft.com/en-us/library/dd364983.aspx

<copied>
At the end of the day, however, if you're using DataTables, the Select
method is one of the worst things you could possibly do to limit the
scalability of your application. We've discussed several alternatives here,
including LINQ, indexing tables to make use of Rows.Find, and morphing the
DataTable into a generic collection. Any of these options will be orders of
magnitude faster than Select for a set of records of reasonable size. You
also want to consider paring your set of records down as much as possible to
speed up both aggregation and selection of records.

<end copy>


__________ Information from ESET NOD32 Antivirus, version of virus signature database 4520 (20091018) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 

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