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 .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 important objects of ADO.Net are:
3) What does DataReader Object?
The DataReader object of ADO.NET is used to provide 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 important features of ADO.NET?
- ADO.NET provides in built classes to make connection with databases like Oracle, SQL Server, MySQL, MS Access etc.
- ADO.NET provides in built classes for data manipulation operations like Insert, Update, Delete and Select data.
- Provide a functionality 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:
7) What are the main differences between classic ADO and ADO.NET?
These are the main differences between ADO and ADO.NET:
|ADO have record set.||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 run time based on metadata so it is a costly process.||It uses known metadata at design time so it provides better run time performance and more consistent run time 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 .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 repeater control.
10) Which ADO.NET object is very fast in getting data from database?
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 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 is 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 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 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
16) What is the difference between Data Reader and Data Adapter?
|Data Reader||Data Adopter|
|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 connection to database to perform any operation on data.||Data adopter is disconnected|
17) What are the different layers of ADO.NET?
Following are three different layers of ADO.NET:
- Presentation Layer
- Business Logic Layer
- Database Access Layer
18) Why is stored procedure used in ADO.NET?
Stored Procedure is used for following reasons:
- To improve performance
- Easy to use and maintain
- For security
- Less time taking for execution
- Less Network Traffic
19) What is the default timeout specified for SqlCommand.CommandTimeout property?
The default timeout for SqlCommand.CommandTimeout property is 30 second.
20) What are the several execute methods of ADO.NET?
These are the different execute methods of ADO.NET command object:
- ExecuteScalar: It returns single value from the dataset.
- ExecutenonQuery: It has multiple values and returns resultset from dataset.
- ExecuteReader: Forwardonly Resultset.
- ExecuteXMLReader: Build XMLReader object from the SQL Query.