Understandably, it cannot ferry information back from the database after the connection has been severed.Furthermore, a Data Reader is limited to being read-only and forward-only.They are designed to work with the particular provider.A Data Reader is one such object (i.e., Sql Data Reader, Ole Db Data Reader, etc.).Open() ' Create command Dim my Command as New Sql Command(SQL query or stored procedure, my Connection) ' Create a Data Reader to ferry information back from the database Dim my Reader as Sql Data Reader my Reader = my Command. End While ' Close the connection (will automatically close the reader) my Connection.Execute Reader() 'Iterate through the results While my Reader. Close() method returns True if a row was loaded from the database, and False if there are no more rows.Regardless of whether or not you bring back database data using a Data Set or Data Reader, you can display the underlying data in a Data Grid, Data List, or Repeater using the exact same code. Simply put, the Data Set's increased feature set makes it a less performant choice for reading data than the Data Reader.According to A Speed Freak's Guide to Retrieving Data in ADO.
For large amounts of data being brought back - several hundred or several thousand records - the absolute time differences between accessing data with these two objects can be quite pronounced.It's the responsibility of the provider's Data Adpater object to translate a particular provider's data into the provider-neutral Data Set.The following code snippet illustrates how to populate a Data Set with data from a SQL query.A couple weeks ago (April 19th) I gave a talk to the local San Diego ASP.NET SIG and during my talk I mentioned how I, personally, rarely, if ever, use Data Sets in my ASP.