| looking for a brokerage account or IRA... click here | Add To Favorites |
| return to index | |
|
C# DataSet v DataReader In C#, a DataSet uses a DataReader to populate itself. By definition, a DataReader is basic and efficient access method to access data and return result as they become available. A DataSet, on the other hand, has to wait for the entire query to process. The Advantages of the DataReaderExample of code:
The foreach loop does not begin until the DataSet is populated. This means any conditional checks or manipulations must occur in the query or after the DataSet is filled. A DataReader, on the other hand, looks like the below.
When to Use a DataSetThere are a few cases when you must use a DataSet. These include cases where one might serialize the results, pass the result onto another application, or write the results to XML using WriteXML. Additional Interesting Articles t-SQL Cursor ©2008 AndrewKimball.com |
|