SqlDataAdapter ,SqlCommand and SqlDataReader

What are difference between SqlDataAdapter ,SqlCommand and SqlDataReader

Questions by sunil thakur

Showing Answers 1 - 6 of 6 Answers

santhosh

  • Aug 6th, 2012
 

sqldatareader means only read the datas in the table..
sqldataadapter means the datas read and writes

  Was this answer useful?  Yes

asifeqbal

  • Mar 19th, 2015
 

SqlDataReader are used to retrieve data in read-only forward-only manner from the data source. It is not used for traversing the data or writing it back to the data source. So SqlDataReader are fastest for reading data.
SqlDataAdapter is a part of the ADO.NET Data Provider and it resides in the System.Data.SqlClient namespace. It works as a bridge between DataSet and Database. It opens the database connection, executes the SQL statements and closes the connection at last. There is no need to open and close the connection. It has two more important methods Fill() and Update(). The Fill() method is used to fill the DataSet or DataTable and Update() is used for saving the changes to the Database in same order as the DataSet, which is made with DataSet.
The SqlCommand are used to execute the SQL statement on the database. SqlCommand carries the command in the CommandText property and this property will be used when the SqlCommand calls any of its execute methods. The three important methods exposed by the SqlCommand object is shown below:
1. ExecuteScalar
2. ExecuteNonQuery
3. ExecuteReader

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions