ADO.Net Interview Questions (Part-1) interview questions

What is ADO.NET?

ADO.NET stands for ActiveX Data Objects . It is a major component of .NET framework. It is designed to connect with different databases like SQL, MySQL, Oracle, and MS Access etc.

What are the benefits of ADO.Net?

Following are the benefits of ADO.Net:

  1. Programmability
  2. Maintainability
  3. Interoperability
  4. Performance
  5. Scalability

What does it mean by Dot Net Framework Data Provider?

A .NET Framework data provider is used for connecting to a database, executing commands, and retrieving results.

Which namespace that is used to include .NET Data Provider for SQL server in .NET code?


What are the two fundamental objects in ADO.NET?

DataReader and DataSet are the two fundamental objects in ADO.NET.

What is DataReader Object?

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.

What is a Dataset object ?

The DataSet is used to store data from a data source . It consists of a set of data tables . We can also specify the relation between the tables inside a dataset.

Which architecture does Datasets follow?

Datasets follow the disconnected data architecture.

What are the Data providers in ADO.Net?

Following are the Data Providers used in ADO.Net:.

  1. SQL server
  2. OLEDB
  3. ODBC
  4. Oracle

What are the differences between OLEDB and SQLClient Providers?

OLEDB provider is used to access any database and provides flexibility of changing the database at any time. SQLClient provider is used to access only SQL Server database but it provides excellent performance than OLEDB provider while connecting with SQL Server database.

What are different layers of ADO.Net?

  1. Presentation Layer
  2. Business Logic Layer
  3. Database Access Layer

What is the use of the Connection object?

Connection object is used to connect data to a Command object.

  1. An OleDbConnection object is used with an OLE-DB provider.
  2. A SqlConnection object uses Tabular Data Services (TDS) with MS SQL Server.

How do you connect to SQL Server Database without using sqlclient?

You can connect SQL Server Database using oledb name space.

Explain about the relationship of XML and ADO.NET?

ADO.NET utilizes the power of XML by providing disconnected access to data. This is designed with the help of XML classes in .NET Framework which form the components of single architecture.

Can we load multiple tables in a Dataset?

Yes, you can load multiple tables in a dataset.

What is the structure DataSet?

Inside DataSet much like in Database, there are tables, columns, constraints, relationships, views and so forth.

What is difference in Record set and Dataset?

Dataset is a connectionless data holder whereas RecordSet is connection oriented Data holder.

What is Data view?

Data view is the representation of data in various formats and it can be requested by the users. Data can be exposed in different sort orders or filter on the user condition with the help of Data view . Data Customization is also possible through Data View.

Which property is used to check whether a DataReader is closed or opened?

The IsClosed property is used to check whether a DataReader is closed or opened. This property returns a true value if a Data Reader is closed, otherwise a false value is returned

What are the pre-requisites for connection pooling?

There must be multiple processes to share the same connection describing the same parameters and security settings. The connection string must be identical.

How to enable and disable connection pooling ?

Use Pooling = true in connection string if we want to enable connection pooling. To disable connection pooling set Pooling = false .

What are the parameters that control most of connection pooling behaviours?

  1. Connect Timeout
  2. Max Pool Size
  3. Min Pool Size
  4. Pooling

Which adapter should you use, if you want to get the data from an Access database?

OleDbDataAdapter is used to get the data from an Access database.

Which ADO.NET object is very fast in getting data from database?


What is Execute Non Query?

The ExecuteNonQuery() is one of the most frequently used method in SqlCommand Object, and is used for executing statements that do not return result sets.

What is the provider and namespaces being used to access oracle database?

Which object is used to add a relationship between two DataTable objects?

The DataRelation object is used to add relationship between two DataTable objects.

What is the difference between the Clone() and Copy() methods of the DataSet class?

The Clone() method copies only the structure of a DataSet. The copied structure includes all the relation, constraint, and DataTable schemas used by the DataSet. The Clone() method does not copy the data, which is stored in the DataSet.

The Copy() method copies the structure as well as the data stored in the DataSet.

What is the difference between Command and CommandBuilder object?

Command is used to execute all kind of queries like DML and DDL . DML is nothing but Insert, Update and Delete. DDL are like Create and drop tables.

Command Builder object is used to build and execute DDL queries like Create and Drop Tables.

Do we use stored procedure in ADO.Net?

Yes, stored procedures are used in ADO.Net and it can be used for common repetitive functions.

Which properties are used to bind a DataGridView control?

The DataSource property and the DataMember property are used to bind a DataGridView control.

Which keyword is used to accept variable number of parameters?

Params keyword is used to accept variable number of parameters.

What is the default Timeout for SqlCommand.CommandTimeout property?

The default timeout of Sqlcommand. CommandTimeout property is 30 Seconds.

What is a linked server?

A linked server is used to enable SQL server to execute commands against OLE DB data sources on remote servers.

What is the use of Parameter Object?

In ADO Parameter object provides information about a single parameter used in a stored procedure or query.

Name the classes are found in System.Data.Common NameSpace?

  1. DataColumnMapping
  2. DataTableMapping

What is the difference between ExecuteScalar, ExecuteReader and ExecuteNonQuery?

  1. ExecuteScalar is typically used when your query returns a single value.
  2. ExecuteReader is used for any result set with multiple rows/columns
  3. ExecuteNonQuery() does not return data at all: only the number of rows affected by an insert, update, or delete.

How to find the null fields in the datareader?

You can use IsDBNull:

if(!SqlReader.IsDBNull(FiledName)) { //code here }

How can we load multiple tables into Dataset?

Filling a DataSet with multiple tables can be done by sending multiple requests to the database, or in a faster way: Multiple SELECT statements can be sent to the database server in a single request.

How can we check that some changes have been made to dataset since it was loaded?

  1. GetChanges: gives the dataset that has changed since newly loaded or since Accept changes has been executed.
  2. HasChanges: this returns a status that tells if any changes have been made to the dataset since accept changes was executed.

If a dataset contains 100 rows, how to fetch rows between 5 and 15 only?

We have the option of the fetching the starting record and the maximum record options.


It will retrieve the record from 5 to next 15 records.

What is Pull Model and Push Model in ADO.Net?

  1. Pull model is used to take out the element/object from Database.
  2. Push model is used to insert the element at top position in table to database through object.