Friday, 3 May 2013

How to handle multiple data tables using Data Reader in ASP.NET


This is best used when you just want to fetch data in read only mode , populate your business entity and close the reader. This is really fast. But you cannot do update with data reader.


Data reader can hold data from multiple tables and data reader can hold more than one table.


If you want to Read/Update the data, You can Read/Update the data with data adapters but it is less faster when reading the data then Data reader.

When you read the results of a batch SQL statement, you can use the NextResult method to position the DataReader at the next result in the result set.


do check like

if(reader.NextResult())


By default, the data reader is positioned on the first result.


No comments:

Post a Comment