Components of data providers in ADO.NET?

 Posted by Tripati_tutu on 10/8/2010 | Category: ADO.NET Interview questions | Views: 3650 | Points: 40

Connection Object: The Connection object represents the connection to the database. The Connection object has ConnectionString which contains all the information required to connect to the database.

Command Object: The command object is used to execute stored procedures and command on the database. It contains methods such as ExecuteNonQuery, ExecuteScalar and ExecuteReader.

ExecuteNonQuery: It executes a command that doesn’t return any record, such as INSERT, UPDATE and DELETE.

ExecuteScalar: It executes and returns a single value from a database.

ExecuteReader: It returns a result set by the DataReader object.

DataReader Object: It provides a connected, forward-only and read-only recordset from a database. The Command.ExecuteReader method creates and returns a DataReader object. Since it is connected to the database through out its lifetime, it requires the use of connection object.

DataAdapter Object: This object acts like a communication bridge between the database and a dataset. It fills the dataset with data from the database. The dataset stores the data in the memory and it allows changes. The DataAdapter update method can transmit the changes to the database.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response