Interview questions for ADO.Net

1. What is an ADO.Net?

ADO.Net is commonly termed as ActiveX Data Objects which is a part of .Net Framework. ADO.Net framework has set of classes which are used to handle data access by connecting with different databases like SQL, Access, Oracle, etc…

2. What are two important objects of ADO.Net?

There are two important objects of ADO.Net:
• DataReader and .
• DataSet.

3. What are the ADO.NET connection pooling parameters?

o Connection Lifetime: default values is 0.
o Connection Timeout: default values is 15.
o Max Pool Size: default values is 100.
o Min Pool Size: default values is 0.
o Pooling: default values are true.
o Incr Pool Size: default values is 5.
o Decr Pool Size: default values is 1.

4. Do you use stored procedure in ADO.NET?

Yes, You can use a stored procedure in ADO.NET. It makes the performance fast because stored procedures are precompiled.

5. What are the namespaces used in ADO.Net to connect to a database?

Following namespaces are used to connect to Database.
1.
• The System.Data namespace.
• The System.Data.OleDb namespace – A data provider used to access database such as Access, Oracle, or SQL.
• The System.Data.SQLClient namespace – Used to access SQL as the data provider.

6. Why is stored procedure used in ADO.NET?

Stored Procedure is used for the following reasons:
o To improve performance
o Easy to use and maintain
o For security
o Less time taking for execution
o Less Network Traffic

7. What is the difference between Data Grid and Data Repeater?

Data Grid:
o Data grid has advanced features and facilitates you to do many things like paging and to sort your data without much effort.
o Data grid can hold text data, but not linked or embedded objects.
Data Repeater:
o A data repeater doesn’t have the paging feature, but it can be done by coding.
o A data repeater can hold other controls and can embed objects.
o A data repeater can embed a data grid within it but vice versa not possible.

8. What is LINQ?

LINQ is native query language for .NET framework and it is specially designed to support queries with the .net applications. LINQ can be connected to SQL and MS Access.

9. What are the advantages of ADO.NET?

Following are the advantages of ADO.NET:
o Programmability
o Maintainability
o Interoperability
o Performance
o Scalability

10. What are the data providers in ADO.NET framework?

Below Data Providers are used in ADO.NET framework.
1. .NET Framework Data Provider for SQL Server – A Data provider that provides access to Microsoft SQL Server 7.0 or later version and it uses the System.Data.SqlClient namespace.
2. .NET Framework Data Provider for OLE DB – A Data Provider that provides access to any database exposed by using OLE DB and it uses the System.Data.OleDb namespace.
3. .NET Framework Data Provider for ODBC – A Data Provider that provides access to any databases exposed by using ODBC and It uses the System.Data.Odbc namespace.
4. .NET Framework Data Provider for Oracle – A Data Provider that provides access to Oracle database 8.1.7 or later versions and it uses the System.Data.OracleClient namespace.

11. What are the important features of ADO.Net 2.0?

Most important features of ADO.NET 2.0:
o Bulk Copy Operation: It facilitates bulk copy operation from one Data Source to another Data Source.
o Batch Update: To update n no of rows in a database table in a single call from a program thus by avoiding round trip to the database.
o Data Paging: To read data from a certain index
o Connection Details: To get detailed info about connections like buffer information, cursor details, etc.
o DataSet.RemotingFormat Property: To make the dataset serialized in Binary
o DataTable’s Load and Save Methods: For XML interactions.

12. What is SqlCommand Object?

The SqlCommand carries the SQL statement that needs to be executed 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 Command Object uses the connection object to execute SQL queries.
• The queries can be in the form of Inline text, Stored Procedures or direct Table access.
• An important feature of Command object is that it can be used to execute queries and Stored Procedures with Parameters.
• If a select query is issued, the result set it returns is usually stored in either a DataSet or a DataReader object.
The three important methods exposed by the SqlCommand object is shown below:
• ExecuteScalar
• ExecuteNonQuery
• ExecuteReader

ExecuteScalar is useful for returning a single value from the database. For example, using this method we can retrieve a sum of sales made by a specific product, total number of records in the employee table, unique id by supplying filtering conditions and so on. Since this method performs faster we do not need to go for the Reader method just to retrieve a single scalar value.

ExecuteNonQuery is useful for performing data manipulation on the database. Simply, the ExecuteNonQuery is for executing the DML statements. The return value of the ExecuteNonQuery is an integral value that represents the number of rows affected by the Operation.

ExecuteReader is used when we need to retrieve rows and columns of data using the SQL select statements. As the data retrieved is a table of data, ExecuteReader returns SqlDataReader. We should iterate through this object to get the required values.

13. Use of DataSet object in ADO.NET?

• It is used in a disconnected architecture.
• Provides lower performance. A DataSet object has read/write access.
• A DataSet object supports multiple tables from various databases.
• A DataSet object is bound to multiple controls.
• A DataSet object has slower access to data.
• A DataSet object is supported by Visual Studio tools.
• We can create relations in a dataset.
• A Dataset supports integration with XML.
• A DataSet communicates with the Data Adapter only.
• A DataSet can modify data.
A DataSet is a collection of DataTable and DataRelations. Each DataTable is a collection of DataColumn, DataRows and Constraints.

leave your comment


Your email address will not be published. Required fields are marked *