Hi....
How can we define SQLDataReaderClass and define architecture in ADO.NET?
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.
Jignesh TrivediPosted Jan 4, 2012, 11:25 PM
please refer following sites.
http://www.dotnetperls.com/sqldatareader
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.aspx
http://stackoverflow.com/questions/4290986/sql-data-reader-class
hope this help.
SenthilkumarPosted Jan 4, 2012, 11:09 PM
The sql data reader is designed to move forward and it cannot come front and fourth while iterating the sql data reader. The SqlCommand has the connection and the required table/sql query/ stored procedure to retrieve the data from the database.
SqlConnection sqlConnection = new SqlConnection(connectionString);
sqlConnection.Open();
SqlCommand sqlCommand = new SqlCommand("SELECT * FROM Product",sqlConnection);
SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
Now the sqldatareader has the record set and it can be iterated to manipulate the data.
The main advantages is it will not bulk loaded and it will load the data on demand. So it will improve the performance significantly. The disadvantages is it always needs the connection.
Satyapriya NayakPosted Jan 5, 2012, 12:00 AM
SQLDataReaderClass Provides a way of reading a forward-only stream of rows from a SQL Server database. This class cannot be inherited.
Please refer the below link
http://www.triconsole.com/dotnet/sqldatareader_class.php
Thanks