What is the difference between a DataTable and a DataReader in ASP?

What is the difference between a DataTable and a DataReader?
bzforum's Avatar, Join Date: May 2012
Go4Expert Member
Quote:
Originally Posted by hireaspdeveloper View Post
What is the difference between a DataTable and a DataReader?
DataReader fetches one record at a time..when ever you all theRead() function the next record if there is any gets fetched..now for this the connection to the database has to be open when the read function is called..

on the other Hand

DataTable fetches all the records when you call the Fill() function of the DataAdapter. It keeps the records in memory so that you can use it latter without been connected to the database..This is an Example of .NET Disconnected Architecture ..

DataReader is lighter than DataTable.