Welcome Guest | Sign in | Register
ADO.NET - DotNet Programming Interview Questions and Answers | LucentBlackBoard | LucentBlackBoard.com
21. What is the use of the Connection object?

The Connection object is used to connect your application to a specific data source by providing the required authentication information in connection string. The connection object is used according to the type of the data source. For example, the OleDbConnection object is used with an OLE-DB provider and the SqlConnectionobject is used with an MS SQL Server.

22. What is the use of the CommandBuilder class?

The CommandBuilder class is used to automatically update a database according to the changes made in aDataSet.

This class automatically registers itself as an event listener to the RowUpdating event. Whenever data inside a row changes, the object of the CommandBuilder class automatically generates an SQL statement and uses theSelectCommand property to commit the changes made in DataSet.

OLEDB provider in .NET Framework has the OleDbCommandBuiider class; whereas, the SQL provider has theSqlCommandBuilder class.

23. Explain the architecture of ADO.NET in brief.

AD0.NET consists of two fundamental components:
• The DataSet, which is disconnected from the data source and does not need to know where the data that it holds is retrieved from.
• The .net data provider, which allows you to connect your application to the data source and execute the SQL commands against it.

The data provider contains the Connection, Command, DataReader, and DataAdapter objects. TheConnection object provides connectivity to the database. The Command object provides access to database commands to retrieve and manipulate data in a database. The DataReader object retrieves data from the database in the readonly and forward-only mode. The DataAdapter object uses Command objects to execute SQL commands. The DataAdapter object loads the DataSet object with data and also updates changes that you have made to the data in the DataSet object back to the database.

24. Describe the disconnected architecture of ADO.NET's data access model.

ADO.NET maintains a disconnected database access model, which means, the application never remains connected constantly to the data source. Any changes and operations done on the data are saved in a local copy (dataset) that acts as a data source. Whenever, the connection to the server is re-established, these changes are sent back to the server, in which these changes are saved in the actual database or data source.

25. What are the usages of the Command object in ADO.NET?

The following are the usages of the Command object in AD0.NET:

The Command object in AD0.NET executes a command against the database and retrieves a DataReader orDataSet object.
• It also executes the INSERT, UPDATE, or DELETE command against the database.
• All the command objects are derived from the DbCommand class.
• The command object is represented by two classes: SqlCommand and OleDbCommand.
• The Command object provides three methods to execute commands on the database:
• The ExecuteNonQuery() method executes the commands and does not return any value.
• The ExecuteScalar() method returns a single value from a database query.
• The ExecuteReader() method returns a result set by using the DataReader object.




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.