ADO.NET Interview Questions
ADO.NET interview Questions-Part 1
1. What is the namespace in which .NET has the data functionality classes?
.NET provides the following name functionality:-
System.data
System.XML
System.Data.OleDB
System.Data.SqlClient
2. What are the two fundamental objects in ADO.NET?
The two fundamental objects in ADO.NET
Datareader
Dataset
3. What is difference between dataset and datareader?
The major difference is that dataset and datareader:-
Dataset can retain content while datareader don’t persist content.
Dataset is a disconnected architecture while datareader is a connected architecture.
Datareader Provides read-only and forward-only access to data.
4. What are the difference between classic ADO and ADO.NET?
Major differences are as follows:-
In classic ADO it had a separate server side and client side cursor which is no longer required in ADO.NET, since it is a disconnected architecture.
It doesn’t support locking
Data are persisted in binary format in classic ADO.
5. What is the use of connection object?
The main use of connection object is that it connects the command object and data.
6. What is the use of dataadapter?
Dataadapter are objects that can connect ot one or more command objects.
• An oleDataAdapter object is used with OLE-DB provider.
• An sglDataAdapter object uses Tabular Data Services.
7. What is Dataset object?
It provides the basis for disconnected storage and manuplates relation data. We fill it from a data store,work with it while disconnected from that data store, then reconnect and flush changes back to the data store if required.
8. What are various in Dataset?
Dataset consist of DataTable object. The DataTable object contains DataRow object and DataColumn objects. They also contain collection of keys, default values and constraints. Finally, each table contain defaultview.
9. How do we use stored procedure in ADO.NET and how do we provide parameters to the stored procedures?
Sql command object is used for providing functionality of executing stored procedures.
10. How can we force the connection object to close after my datareader is closed ?
Executereader command method takes parameter called as CommandBehavior if we specify close connection automatically after the Datareader is close.
pobjDataReader = pobjCommand.ExecuteReader(CommandBehavior.CloseConnection)
11. What are the various methods provided by the dataset object to generate XML?
Various method provided by dataobject to generate XML are as follows:-
GetXML
ReadXML
WriteXML
12. What is the basic use of “DataView”?
It represents a table or a section of rows based on some criteria. It is mainly used for sorting and finding data in datatable.
13. Explain the methods in DataView?
FindRow:- It takes array of value and “DataRow” collection.
Find:- It takes array of value and return row index.
AddNew:- It adds a new row to the DataView object.
14. How can we load multiple tables in a Dataset?
Below code creates two tables
objCommand.CommandText = "Myfirsttable"
objDataAdapter.Fill(objDataSet, "Myfirsttable")
objCommand.CommandText = "Mysecondtable"
objDataAdapter.Fill(objDataSet, "Mysecondtable")
15. How can we add relation’s between table in a DataSet?
DataRelation object can be used to develop relation between tables.
For Example:-
Dim objRelation As DataRelation objRelation=New DataRelation("CustomerAddresses",objDataSet.Tables("Customer").Columns("Custid") ,objDataSet.Tables("Addresses").Columns("Custid_fk")) objDataSet.Relations.Add(objRelation)
16.What is the use of CommandBuilder?
CommandBulider is used to build objects parameters automatically.
For Example:-
Dim pobjCommandBuilder As New OleDbCommandBuilder(pobjDataAdapter) pobjCommandBuilder.DeriveParameters(pobjCommand)
17. How many way are there to implement locking in ADO.NET?
Method “Update” in DataAdapter can be used to handle locking internally.
Locking can be handled on SQL side or ADO.NET side.
18. How can we perform transactions in .NET?
Open a database connection
Use begin Transaction method to begin transaction.
Execute the SQL command
Commit or roll back the transaction
Close the connectivity.
19. What is the difference between Dataset.clone and Dataset.copy?
Dataset.Clone:- It doesn’t copy the data but only the structure
Dataset Copy:- It copies both structure and data
20. Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
There two main basic differences between recordset and dataset :-272
With dataset you an retrieve data from two databases like oracle and sql server and merge them in one dataset , with recordset this is not possible
All representation of Dataset is using XML while recordset uses COM.
Recordset can not be transmitted on HTTP while Dataset can be.
21. What is the difference between optimistic and pessimistic locking?
Pessimistic is used when the user want to lock the records so that no one can update data. The user are only allowed to view the data.
In optimistic multiple user can update an view the data
22. Explain the namespace System.Data?
It contains basic objects that is used to access and to store data. Each of these is independent of the type of data source and the way we connect to it.
DataRelation
Dataset
DataTable
23. Explain the namespace System.XML?
System.XML Contains the basic objects required to create, read, store, write, and manipulate XML documents according to W3C recommendations.
24. What is the use of command objects?
They are used to connect connection object to Datareader or dataset. objects?
25. What are the methods in Command object?
Methods in command object:-
ExecuteNonQuery
ExecuteScalar
ExecuteReade
ADO.NET interview Questions-Part 2
1.What are the advantages of ADO.NET?
The advantages of ADO.NET are as follows:-
It is not dependent on live connection
The data can be cached in Datasets
Data Source independent of Datasets
The data’s are persisted in the XML
Data Structure are defined by schemas
2.Name some of the top level objects which ADO consists?
Top level objects are
Record object
Parameter object
Stream object
Connection object
3.Explain about the relationship of XML and ADO.NET?
AD.NET provides disconnected data access with the help of XML. .NET framework provides single architecture.
4.What is the purpose of connection pooling in ADO.NET?
Connection pooling enables an application to use a connection from a pool of connections that do not need to be re-established for each use. Once a connection has been created and placed in a connection pool, an application can reuse that connection without performing the complete connection creation process.
5.What are the features of ADO.NET?
Some of the features provided by ADO.NET are
Server Enumeration
Bulk Copy operation
Batch processing
Tracing
Partial Trust
Provider Statistics
6.Difference between SqlCommand and SqlCommandBuilder
SQLCommand is used to retrieve or update the data from database.
SQLBUILDER is used to build the SQL Command.
7.What are the different languages which implement ADO?
Several languages and
VB script in ASP
Delphi
C++
8.Explain about RDO?
RDO indicates remote data object. This represents data access application programming interface used in operating systems of windows. This was primarily designed for visual basic applications. This feature allows data base developers to interact directly with Open data base connectivity.
9.Compare and explain about ADO.NET and visual studio. NET?
Visual studio.NET is most preferable to create specialized sub classes. Intellisense are helpful. Visual studio supports database schema.
10.How can you find a problem in the data stack?
Following problem arise with data stack:-
Mismatch between client and database schema
Wrongly generated SQL
Wrong program logic
11.Explain about DB enumerator?
ADO.NET consist of base class. This facilitates in obtaining the list of data sources. The instances available on the network is provided by the SQL server.
12. Some of the basic steps required to access and manipulate data?
Basic steps in the process to access and manipulate data are as follows:-
Creating connection object to connect to database
To facilitate connection record set object should be created.
Update and update batch can be used to make changes.
13. What are the benefits of ADO.NET?
Benefits of ADO.NET are as follows:-
Maintainability
Interoperability
Programmability
14. Explain about LINQ?
Language integrated query or LINQ provides developers to query data. It uses strongly typed queries and results. Developer productivity increases by the usage of compile time error checking and intellisense. This feature is common on number of data types.
15. What is the architecture of connected environment of data access in ADO.NET?
The connected environment of data access is the traditional procedure for accessing data programmatically. The differentiating property of the connected data access environment is that here you (the programmer) is required to manage the connection with the database. You can only perform database operations when, there exists an open connection to the database. Hence, before performing any database operation (select, update, insert, delete), the programmer opens a database connection and close the database connection after performing the database operations.
16. What are the important objects in the connected environment?
Connection
Command
Datareader
17. What is the Dot Net Framework data provider for OLEDB?
The .NET famework data provider for OLEDB generates connectivity with support from OLEDB. It is the recommended middle tier for the SQL Server 6.5 or earlier and Microsoft Access Database. It is a general data provider. You can also use it to connect with the SQL Server or Oracle Database Management Systems. The classes for this provider are present in the System.Data.OleDBClient namespace.
18. Explain LINQ to Entities?
This feature allows LINQ query capabilities and it specifically forms a part of the .NET framework. This feature allows developers to program in ADO.NET and ORM. This feature also allows access to third party database. This provides new features to entity data.
19. How to create SQL command object?
SQL command object can be created similar to that of C# objects.
New instance declaration can be used to instantiate a SqlCommand object
SqlCommand cmd = new SqlCommand("select CategoryName from Categories", conn);
20. What are the action performed while updating data source?
Open connection
Writing the changes to data source from DataSet
Close Connection
21. Why do application developers need ADO.NET?
ADO.Net is capable of providing comprehensive caching data model. That marshal the data between the services and the application. This makes the developer to make use of XML with knowledge in SQL.
22.Which version of the .NET Framework does DataDirect Technologies support?
DataDirect Technologies will fully support ADO.NET 2.0 functionality in the Microsoft .NET Framework 2.0 in an upcoming release.
23. How does ADO.NET work?
ADO.NET establishes connection with data source, pass the query, update and process the result.
24. List the key components of ADO.NET?
Key components of ADO.NET are as follows:-
Application
DataSet
DataReader
.NET provider
25. What are .NET framework data providers?
Some of the .NET framework providers are:-
Datareader
Dataadapter
Command
1. What is the namespace in which .NET has the data functionality classes?
.NET provides the following name functionality:-
System.data
System.XML
System.Data.OleDB
System.Data.SqlClient
2. What are the two fundamental objects in ADO.NET?
The two fundamental objects in ADO.NET
Datareader
Dataset
3. What is difference between dataset and datareader?
The major difference is that dataset and datareader:-
Dataset can retain content while datareader don’t persist content.
Dataset is a disconnected architecture while datareader is a connected architecture.
Datareader Provides read-only and forward-only access to data.
4. What are the difference between classic ADO and ADO.NET?
Major differences are as follows:-
In classic ADO it had a separate server side and client side cursor which is no longer required in ADO.NET, since it is a disconnected architecture.
It doesn’t support locking
Data are persisted in binary format in classic ADO.
5. What is the use of connection object?
The main use of connection object is that it connects the command object and data.
6. What is the use of dataadapter?
Dataadapter are objects that can connect ot one or more command objects.
• An oleDataAdapter object is used with OLE-DB provider.
• An sglDataAdapter object uses Tabular Data Services.
7. What is Dataset object?
It provides the basis for disconnected storage and manuplates relation data. We fill it from a data store,work with it while disconnected from that data store, then reconnect and flush changes back to the data store if required.
8. What are various in Dataset?
Dataset consist of DataTable object. The DataTable object contains DataRow object and DataColumn objects. They also contain collection of keys, default values and constraints. Finally, each table contain defaultview.
9. How do we use stored procedure in ADO.NET and how do we provide parameters to the stored procedures?
Sql command object is used for providing functionality of executing stored procedures.
10. How can we force the connection object to close after my datareader is closed ?
Executereader command method takes parameter called as CommandBehavior if we specify close connection automatically after the Datareader is close.
pobjDataReader = pobjCommand.ExecuteReader(CommandBehavior.CloseConnection)
11. What are the various methods provided by the dataset object to generate XML?
Various method provided by dataobject to generate XML are as follows:-
GetXML
ReadXML
WriteXML
12. What is the basic use of “DataView”?
It represents a table or a section of rows based on some criteria. It is mainly used for sorting and finding data in datatable.
13. Explain the methods in DataView?
FindRow:- It takes array of value and “DataRow” collection.
Find:- It takes array of value and return row index.
AddNew:- It adds a new row to the DataView object.
14. How can we load multiple tables in a Dataset?
Below code creates two tables
objCommand.CommandText = "Myfirsttable"
objDataAdapter.Fill(objDataSet, "Myfirsttable")
objCommand.CommandText = "Mysecondtable"
objDataAdapter.Fill(objDataSet, "Mysecondtable")
15. How can we add relation’s between table in a DataSet?
DataRelation object can be used to develop relation between tables.
For Example:-
Dim objRelation As DataRelation objRelation=New DataRelation("CustomerAddresses",objDataSet.Tables("Customer").Columns("Custid") ,objDataSet.Tables("Addresses").Columns("Custid_fk")) objDataSet.Relations.Add(objRelation)
16.What is the use of CommandBuilder?
CommandBulider is used to build objects parameters automatically.
For Example:-
Dim pobjCommandBuilder As New OleDbCommandBuilder(pobjDataAdapter) pobjCommandBuilder.DeriveParameters(pobjCommand)
17. How many way are there to implement locking in ADO.NET?
Method “Update” in DataAdapter can be used to handle locking internally.
Locking can be handled on SQL side or ADO.NET side.
18. How can we perform transactions in .NET?
Open a database connection
Use begin Transaction method to begin transaction.
Execute the SQL command
Commit or roll back the transaction
Close the connectivity.
19. What is the difference between Dataset.clone and Dataset.copy?
Dataset.Clone:- It doesn’t copy the data but only the structure
Dataset Copy:- It copies both structure and data
20. Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
There two main basic differences between recordset and dataset :-272
With dataset you an retrieve data from two databases like oracle and sql server and merge them in one dataset , with recordset this is not possible
All representation of Dataset is using XML while recordset uses COM.
Recordset can not be transmitted on HTTP while Dataset can be.
21. What is the difference between optimistic and pessimistic locking?
Pessimistic is used when the user want to lock the records so that no one can update data. The user are only allowed to view the data.
In optimistic multiple user can update an view the data
22. Explain the namespace System.Data?
It contains basic objects that is used to access and to store data. Each of these is independent of the type of data source and the way we connect to it.
DataRelation
Dataset
DataTable
23. Explain the namespace System.XML?
System.XML Contains the basic objects required to create, read, store, write, and manipulate XML documents according to W3C recommendations.
24. What is the use of command objects?
They are used to connect connection object to Datareader or dataset. objects?
25. What are the methods in Command object?
Methods in command object:-
ExecuteNonQuery
ExecuteScalar
ExecuteReade
ADO.NET interview Questions-Part 2
1.What are the advantages of ADO.NET?
The advantages of ADO.NET are as follows:-
It is not dependent on live connection
The data can be cached in Datasets
Data Source independent of Datasets
The data’s are persisted in the XML
Data Structure are defined by schemas
2.Name some of the top level objects which ADO consists?
Top level objects are
Record object
Parameter object
Stream object
Connection object
3.Explain about the relationship of XML and ADO.NET?
AD.NET provides disconnected data access with the help of XML. .NET framework provides single architecture.
4.What is the purpose of connection pooling in ADO.NET?
Connection pooling enables an application to use a connection from a pool of connections that do not need to be re-established for each use. Once a connection has been created and placed in a connection pool, an application can reuse that connection without performing the complete connection creation process.
5.What are the features of ADO.NET?
Some of the features provided by ADO.NET are
Server Enumeration
Bulk Copy operation
Batch processing
Tracing
Partial Trust
Provider Statistics
6.Difference between SqlCommand and SqlCommandBuilder
SQLCommand is used to retrieve or update the data from database.
SQLBUILDER is used to build the SQL Command.
7.What are the different languages which implement ADO?
Several languages and
VB script in ASP
Delphi
C++
8.Explain about RDO?
RDO indicates remote data object. This represents data access application programming interface used in operating systems of windows. This was primarily designed for visual basic applications. This feature allows data base developers to interact directly with Open data base connectivity.
9.Compare and explain about ADO.NET and visual studio. NET?
Visual studio.NET is most preferable to create specialized sub classes. Intellisense are helpful. Visual studio supports database schema.
10.How can you find a problem in the data stack?
Following problem arise with data stack:-
Mismatch between client and database schema
Wrongly generated SQL
Wrong program logic
11.Explain about DB enumerator?
ADO.NET consist of base class. This facilitates in obtaining the list of data sources. The instances available on the network is provided by the SQL server.
12. Some of the basic steps required to access and manipulate data?
Basic steps in the process to access and manipulate data are as follows:-
Creating connection object to connect to database
To facilitate connection record set object should be created.
Update and update batch can be used to make changes.
13. What are the benefits of ADO.NET?
Benefits of ADO.NET are as follows:-
Maintainability
Interoperability
Programmability
14. Explain about LINQ?
Language integrated query or LINQ provides developers to query data. It uses strongly typed queries and results. Developer productivity increases by the usage of compile time error checking and intellisense. This feature is common on number of data types.
15. What is the architecture of connected environment of data access in ADO.NET?
The connected environment of data access is the traditional procedure for accessing data programmatically. The differentiating property of the connected data access environment is that here you (the programmer) is required to manage the connection with the database. You can only perform database operations when, there exists an open connection to the database. Hence, before performing any database operation (select, update, insert, delete), the programmer opens a database connection and close the database connection after performing the database operations.
16. What are the important objects in the connected environment?
Connection
Command
Datareader
17. What is the Dot Net Framework data provider for OLEDB?
The .NET famework data provider for OLEDB generates connectivity with support from OLEDB. It is the recommended middle tier for the SQL Server 6.5 or earlier and Microsoft Access Database. It is a general data provider. You can also use it to connect with the SQL Server or Oracle Database Management Systems. The classes for this provider are present in the System.Data.OleDBClient namespace.
18. Explain LINQ to Entities?
This feature allows LINQ query capabilities and it specifically forms a part of the .NET framework. This feature allows developers to program in ADO.NET and ORM. This feature also allows access to third party database. This provides new features to entity data.
19. How to create SQL command object?
SQL command object can be created similar to that of C# objects.
New instance declaration can be used to instantiate a SqlCommand object
SqlCommand cmd = new SqlCommand("select CategoryName from Categories", conn);
20. What are the action performed while updating data source?
Open connection
Writing the changes to data source from DataSet
Close Connection
21. Why do application developers need ADO.NET?
ADO.Net is capable of providing comprehensive caching data model. That marshal the data between the services and the application. This makes the developer to make use of XML with knowledge in SQL.
22.Which version of the .NET Framework does DataDirect Technologies support?
DataDirect Technologies will fully support ADO.NET 2.0 functionality in the Microsoft .NET Framework 2.0 in an upcoming release.
23. How does ADO.NET work?
ADO.NET establishes connection with data source, pass the query, update and process the result.
24. List the key components of ADO.NET?
Key components of ADO.NET are as follows:-
Application
DataSet
DataReader
.NET provider
25. What are .NET framework data providers?
Some of the .NET framework providers are:-
Datareader
Dataadapter
Command

0 Comments:
Post a Comment
<< Home