Datatable vs Dataset *

Question

I currently use a datatable to get results from a database which I can use in my code.

However, many example on the web show using a dataset instead and accessing the table(s) through the collections method.

Is there any advantage, performance wise or otherwise, of using datasets or datatables as a storage method for sql results?

Answer

It really depends on the sort of data you're bringing back. Since a DataSet is (in effect) just a collection of DataTable objects, you can return multiple distinct sets of data into a single, and therefore more manageable, object.

Performance-wise, you're more likely to get inefficiency from unoptimised queries than from the "wrong" choice of .NET construct. At least, that's been my experience.

< br > via < a class="StackLink" href=" http://stackoverflow.com/questions/2250/" >Datatable vs Dataset< /a>
Share on Google Plus

About Cinema Guy

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment