ADO Dot NET Interview Questions


Q#1. What is ADO.NET?

Ans. ADO.net Stands for Microsoft ActiveX Data Object. Ado.net is a database technology which we can think like a set of classes that can be used to interact with the data sources like databases and XML files. Asp.net application, windows application, console application are the few types of .net applications that use ADO.NET to connect with the databases to execute commands and retrieve data.


Q#2. What are the ADO.NET components?

Ans. ADO.NET components categorized in three modes: disconnected, common or shared and the .NET data providers. The disconnected components build the basic ADO.NET architecture. You can use these components (or classes) with or without data providers. For example, you can use a DataTable object with or without providers and shared or common components are the base classes for data providers. Shared or common components are the base classes for data providers and shared by all data providers. The data provider components are specifically designed to work with different kinds of data sources. For example, ODBC data providers work with ODBC data sources and OleDb data providers work with OLE-DB data sources.


Q#3. What are the data providers in ADO.NET framework?

Ans. Below Data Providers are used in ADO.NET framework. .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. .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. .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. .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.


Q#4. What are the key features of ADO.NET?

Ans. Disconnected Data Architecture. Data cached in DataSet. Scalability Data transfer in XML Format. Strongly typed language.


Q#5. What is Connection Pooling in ADO.NET?

Ans. Connection pooling is the ability of reusing your connection to the database. This means if you enable Connection pooling in the connection object, actually you enable the re-use of the connection to more than one user. ADO.NET uses a technique called connection pooling, which minimizes the cost of repeatedly opening and closing connections. Connection pooling reuses existing active connections with the same connection string instead of creating new connections when a request is made to the database. It involves the use of a connection manager that is responsible for maintaining a list, or pool, of available connections for a given connection string. Several pools exist if different connection strings ask for connection pooling.


Q#6. What is DataReader Object?

Ans. Datareader is an object of ADO.Net which provides access to data from a specified data source. It consists of classes which sequentially read data from a data source like Oracle, SQL or Access.


Q#7. Why is it important to close an ADO.NET application?

Ans. Connections need to be closed properly because it affects the scalability and reliability of the applications. For open connections it is always vulnerable to attack, so to be short, ‘Open connections as late as possible and close it as early as possible’. We can ‘Close’ the connections by ‘final’ block or ‘using’ the USING statement.


Q#8. What is a Dataset?

Ans. Dataset is a disconnected copy of data that gets populated in the client PC. It contains Datatables and Datarelations. Generally, DataAdapter is required for populating a Dataset with the data. Since it is disconnected, the user no longer need to be connected to the database every time and data manipulations are performed without interacting with the data source. It is very fast and reliable as it resides in the local system. Two Objects in Dataset DataTableCollection DataRelationCollection Two Types of Dataset Typed Dataset Untyped Dataset


Q#9. What is Dataset Object?

Ans. A Dataset is set to be collection of data with a tabular column representation. Each column in the table represents a variable and the row represents to value of a variable. This Dataset object can be obtained from the database values.


Q#10. What is object pooling?

Ans. Object pooling is nothing but a repository of the objects in memory which can be used later. This object pooling reduces the load of object creation when it is needed. Whenever there is a need of object, object pool manager will take the request and serve accordingly.