ADO.NET Interview Questions

ADO.NET Interview Questions

A list of top frequently asked ADO.NET interview questions and answers are given below.

1) What is ADO.NET?

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


2) What are the objects of ADO.NET?

The two essential objects of ADO.Net are:

  • DataReader
  • DataSet

3) What does DataReader Object do?

The DataReader object of ADO.NET is used to provide the access of data from a specified data source. It contains classes to sequentially read data from a data source like Oracle, MS Access, SQL Server, etc.


4) Can we load multiple tables in a Dataset?

Yes, you can load multiple tables in a dataset.


5) What are the essential features of ADO.NET?

  • ADO.NET provides inbuilt classes to make a connection with databases like Oracle, SQL Server, MySQL, MS Access, etc.
  • ADO.NET provides inbuilt classes for data manipulation operations like Insert, Update, Delete and Select data.
  • Provide a function to combine data from different data sources.
  • Disconnect data architecture for better performance.

6) What are the advantages of ADO.NET?

Following are the advantages of ADO.NET:

  • Programmability
  • Maintainability
  • Interoperability
  • Performance
  • Scalability

7) What are the main differences between classic ADO and ADO.NET?

These are the main differences between ADO and ADO.NET:

ADOADO.NET
ADO have recordset.
ADO.NET have data adopter and data set.
The objects of ado communicate in binary mode.
It uses XML for passing the data.
It supports mostly connection oriented models.
It works in disconnected manners.
It derives information about data implicitly at runtime based on metadata, so it is a costly process.
It uses known metadata at design time, so it provides better runtime performance and more consistent runtime behavior.
It allows only client-side cursors.
It supports both client side and server side cursors.

8) What is LINQ?

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


9) Is it possible to edit data in Repeater control?

No. It is read-only and forward-only control, so it is not possible to edit data in a repeater control.


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

SqlDataReader object.


11) What is connection pooling?

Connection pooling contains database collections so that the connection can be used or reused whenever there is a request to the database. This technique increases the performance of executing the database commands because there is no need to create a new connection.


12) What are the ADO.NET connection pooling parameters?

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

13) 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.


14) What is the use of Dataview?

Dataview is used to represent a whole table or a part of the table. It is used for sorting and searching data in the data table.


15) What are the data providers used in ADO.NET

Following are the data providers used in ADO.NET:

  • MS SQL Server
  • OLEDB
  • ODBC

16) What is the difference between Data Reader and Data Adapter?

Data ReaderData Adopter
The Data reader is read-only, forward only. It is much faster than data adopter.It is comparatively slower.
Data reader facilitates you to open and close connection explicitly.If you use data adopter, the connection is automatically open and closed.
Data reader makes a connection to the database to operate on data.Data adopter is disconnected.

17) What is the usage of the DataSet object in ADO.NET?

DataSet object is one of the major components of ADO.NET. It always remains disconnected from the database and reduces the load on the database.


18) What are the different ADO.NET Namespaces?

A list of ADO.NET Namespaces:

IndexNamespacesDescription
1)System.DataIt contains the definition for columns, relations, tables, database, rows, views, and constraints.
2)System.Data.SqlClientIt contains the classes that are used to connect to a Microsoft SQL Server database such as SqlCommand, SqlConnection, SqlDataAdapter.
3)System.Data.OdbcIt contains classes required to connect to most Odbc Drivers. These classes include OdbcCommand, OdbcConnection.
4)System.Data.OracleClientIt contains classes such as OracleConnection, OracleCommand required to connect to an Oracle database.

19) What are the different layers of ADO.NET?

Following are three different layers of ADO.NET:

  • Presentation Layer
  • Business Logic Layer
  • Database Access Layer

20) Why is stored procedure used in ADO.NET?

Stored Procedure is used for the following reasons:

  • To improve performance
  • Easy to use and maintain
  • For security
  • Less time taking for execution
  • Less Network Traffic

21) What is the difference between Data Grid and Data Repeater?

Data Grid:

  • Data grid has advanced features and facilitates you to do many things like paging and to sort your data without much effort.
  • Data grid can hold text data, but not linked or embedded objects.

Data Repeater:

  • A data repeater doesn't have the paging feature, but it can be done by coding.
  • A data repeater can hold other controls and can embed objects.
  • A data repeater can embed a data grid within it but vice versa not possible.

22) What is the difference between DataReader and DataSet?

A list of differences between DataReader and DataSet:

IndexDataReaderDataSet
1)Forward only.Loop through the DataSet.
2)Connected recordset.Disconnected recordset.
3)Single table involved.Multiple tables involved.
4)No relationship required.A Relationship between tables maintained.
5)No XML storage.Can be stored as XML.
6)Occupies less memory.Occupies more memory.
7)Read-onlyCan do addition /Updation and deletion

23) 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.


24) What is the default timeout specified for "SqlCommand.CommandTimeout" property?

The default timeout for SqlCommand.CommandTimeout property is 30 second.


25) What are the several execute methods of ADO.NET?

These are the different execute methods of ADO.NET command object:

  • ExecuteScalar: It returns a single value from the dataset.
  • ExecutenonQuery: It has multiple values and returns resultset from the dataset.
  • ExecuteReader: Forward-only Resultset.
  • ExecuteXMLReader: Build XMLReader object from the SQL Query.

26) What are the important features of ADO.Net 2.0?

Most important features of ADO.NET 2.0:

  • Bulk Copy Operation: It facilitates bulk copy operation from one Data Source to another Data Source.
  • 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.
  • Data Paging: To read data from a certain index
  • Connection Details: To get detailed info about connections like buffer information, cursor details, etc.
  • DataSet.RemotingFormat Property: To make the dataset serialized in Binary
  • DataTable's Load and Save Methods: For XML interactions.


Latest Courses