Hi,
What is main work of DataReader class in .NET?
Thanks
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Datta KharadPosted Jan 11, 2012, 5:43 AM
Refer our useful articles:-
http://www.c-sharpcorner.com/uploadfile/61b832/datareader-vs-dataset/
http://www.c-sharpcorner.com/uploadfile/mahesh/datareader-in-ado-net/
Jignesh TrivediPosted Jan 11, 2012, 1:49 AM
DataReader Object in ADO.NET is a stream-based , forward-only, read-only retrieval of query results from the Data Sources , which do not update the data. The DataReader cannot be created directly from code, they can created only by calling the ExecuteReader method of a Command Object.
The DataReader Object provides a connection oriented data access to the Data Sources. A Connection Object can contain only one DataReader at a time and the connection in the DataReader remains open, also it cannot be used for any other purpose while data is being accessed. When we started to read from a DataReader it should always be open and positioned prior to the first record. The Read() method in the DataReader is used to read the rows from DataReader and it always moves forward to a new valid row, if any row exist .
DataReader.Raed();
Usually we are using two types of DataReader in ADO.NET. They are SqlDataReader and the OleDbDataReader . The System.Data.SqlClient and System.Data.OleDb are containing these DataReaders respectively. From the following link you can see in details about these classes in C#.
also refer :http://msdn.microsoft.com/en-us/library/haa3afyz.aspx
hope this help.
Satyapriya NayakPosted Jan 5, 2012, 12:22 AM
DataReader: Reads a forward-only, read-only stream of data from a data source.
Thanks