ADO.Net Interview Questions and Answers for Freshers, Experienced

This article provides latest ADO.Net Interview Questions and Answers for Freshers and 2-3 years experienced dot net developers with sample code and detailed explanations on Dataset, Datareader, Datatable, DataView, Connection object, Transactions, SQL Commands, Data adapter, Data Providers, Locking, Connection pooling and Connection String.
1) What is ADO.NET ?
ADO.Net is one of the major component of .Net Framework, which is designed to connect to databases like Oracle, MySQL, SQL Server, MS Access etc. and work with data stored in them.
2) Explain Generic Features of ADO.Net ?
  • ADO.Net provides in built classes to connect with Databases like Oracle, MySQL, SQL Server, MS Access etc.
  • Provides in built classes to do data manipulation operations like Insert, Update, Delete and Select data.
  • Provides data providers for specific databases for efficient interactions with DB. Example - ODP.Net provider for Oracle.
  • Tight integration with XML
  • Provides functionality to combine data from different data sources
  • Disconnected Data architecture for better performance

3)
 What are the important features of ADO.Net 2.0 ?
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 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 dataset serialized in Binary
  • DataTable's Load and Save Methods – For XML interactions.

4) What are the namespaces used in ADO.NET for data access ?
Namespaces used to access database are
  • System.Data – Contains all generic data access classes
  • System.Data.Common – Contains classes which are shared / overridden by data providers
  • System.Data.OleDb - OLE DB provider classes used to access database such as Oracle, MySQL, SQL Server and MS Access.
  • System.Data.SqlClient – Contains classes for SQL Server
  • System.Data.SqlTypes – Contains SQL Server data types

5) What are major difference between classic ADO and ADO.NET ?
ADO
  • ADO have recordset
  • ADO objects communicate in binary mode
  • ADO supports mostly connection oriented models
  • Since ADO derives information about data implicitly at run time based on metadata, it is an expensive process.
  • Only Client Side Cursors are allowed in ADO.
ADO.Net
  • ADO.Net have Data Adapter and Data set
  • ADO.NET uses XML for passing the data
  • ADO.Net works in Disconnected manner
  • By leveraging known meta data at design time, ADO.Net provide better runtime performance and more consistent runtime behaviour
  • ADO.Net Support both client side and server side cursors


6) What are the two fundamental objects in ADO.NET ?
Fundamental Objects of ADO.Net are DataReader and DataSet. DataSet Object can have a set of DataTables and relationships between these tables. DataSet can be used in disconnected connection with DB. DataReader is used to read the read only data from a database.
7) What is difference between dataset and datareader ?
DataReader is used to fetch data from a database in a much faster way. Since the rows are fetched one at a time, load on the network will be low. Since DataReader is read only, transactions are not allowed. Since it support forward only data iteration, random data fetch is not supported.
DataSet is an in-memory representation of a table in a database. Dataset takes lot of application memory compared to DataReader. It is slower compared to DataReader. But user can do transactions using DataSet. It also support querying.

8) What is the use of connection object ?
Connection Objects is used to establish a connection between an application and databases like Oracle, MySQl, SQL Server etc. Once connection is established, SQL Commands like insert, update, delete and select can be executed. Scope of a connection object can be local or global. If local connection object is used, it should be closed after SQL commands are executed.

No comments:

Post a Comment

How to register multiple implementations of the same interface in Asp.Net Core?

 Problem: I have services that are derived from the same interface. public interface IService { } public class ServiceA : IService { ...