get the app get the app       get the app       get the app

ADO .NET Interview Questions

Exam NameADO .NET Interview Questions
DescriptionADO .NET Interview Questions contains the questions from various interview of IT industry.These questions are helpful to crack the IT interview.
Exam TypePUBLIC
Authenticity3
creatorPayal(314)
Create Question   Practise  

Back to Parent Category
Question: What is ADO.NET ?

Answer: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.


Question: Explain Generic Features of ADO.Net ?

Answer:
  • 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



  • Question: What are the namespaces used in ADO.NET for data access ?

    Answer: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



  • Question: What are major difference between classic ADO and ADO.NET ?

    Answer: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



  • Question: What are the two fundamental objects in ADO.NET ?

    Answer:Fundamental Objects of ADO.Net are DataReader and DataSet . DataSet Object can have a set of DataTables, 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.



    Question: What is difference between dataset and datareader ?

    Answer: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 is forward only, random data fetch is not supported.

    DataSet is an in memory representation of a tables in a database. Dataset takes lot of application memory compared to DataReader. Its slower compared to DataReader. But user can do transactions using DataSet. It also support querying.



    Question: What is the use of connection object ?

    Answer: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.


    Question: What is the use of Command objects?

    Answer:They are used to connect a Connection object to a DataReader or DataSet. Following are the methods provided by a Command object:

  • ExecuteNonQuery
    Executes the command defined in the CommandText property against the connection defined in the Connection property for a query that does not return any row (an UPDATE, DELETE, or INSERT). Returns an Integer indicating the number of rows affected by the query.

  • ExecuteReader
    Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns a "reader" object that is connected to the resulting row set within the database, allowing the rows to be retrieved.

  • ExecuteScalar
    Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns only a single value (effectively the first column of the first row of the resulting row set, any other returned columns and rows are discarded). It is fast and efficient when only a "singleton" value is required.



  • Question: What is the use of a data adapter?

    Answer:These objects connect one or more Command objects to a DataSet object. They provide logic that would get data from the data store and populates the tables in the DataSet, or pushes the changes in the DataSet back into the data store.

  • An OleDbDataAdapter object is used with an OLE-DB provider
  • A SqlDataAdapter object uses Tabular Data Services with MS SQL Server.



  • Question: What is a DataSet object?

    Answer:The DataSet provides the basis for disconnected storage and manipulation of relational 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.


    Question: What are the various objects in a DataSet?

    Answer:DataSet has a collection of DataTable objects within the Tables collection. Each DataTable object contains a collection of DataRow objects and a collection of DataColumn objects. There are also collections for primary keys, constraints, and default values used in this table, which is called as constraint collection, and the parent and child relationships between the tables. Finally, there is a DefaultView object for each table. This is used to create a DataView object based on the table, so that the data can be searched, filtered, or otherwise manipulated while displaying the data.