ADO.Net Interview Question and Answers Part I
1.
|
What
is Ado.NET?
|
|
§ ADO.NET is an
object-oriented set of libraries that allows you to interact with data
sources.
§ ADO.NET is a set of
classes that expose data access services to the .NET programmer.
§ ADO.NET is also a part of
the .NET Framework.
§ ADO.NET is used to handle
data access.
|
2.
|
What
are the two fundamental objects in ADO.NET?
|
|
There
are two fundamental objects in ADO.NET.
Datareader - connected
architecture and
Dataset - disconnected
architecture.
|
3.
|
What
are the data access namespaces in .NET?
|
|
The most common data
access namespaces :
§ System.Data
§ System.Data.OleDb
§ System.Data.SQLClient
§ System.Data.SQLTypes
§ System.Data.XML
|
4.
|
What
are major difference between classic ADO and ADO.NET?
|
|
In ADO the in-memory representation of data is the
recordset.A Recordset object is used to hold a set of records from a database
table.
In ADO.NET we have dataset.A DataSet is an in
memory representation of data loaded from any data source.
|
5.
|
what
is the use of connection object in ado.net?
|
|
The ADO
Connection Object is used to create an open connection to a data source.
Through this connection, you can access and manipulate a database.
|
6.
|
What
are the benefits of ADO.NET?
|
|
§ Scalability
§ Data Source Independence
§ Interoperability
§ Strongly Typed Fields
§ Performance
§
7.
|
What is a Clustered Index?
|
|
The data rows are stored in order based on the clustered index
key. Data stored is in a sequence of the index. In a clustered index, the
physical order of the rows in the table is the same as the logical
(indexed) order of the key values. A table can contain only one clustered
index. A clustered index usually provides faster access to data than does a
non-clustered index.
|
§
8.
|
What is a Non-Clustered Index?
|
|
The data rows are not stored in any particular order, and
there is no particular order to the sequence of the data pages. In a
clustered index, the physical order of the rows in the table is not same as
the logical (indexed) order of the key values.
|
§
9.
|
Whate are different types of Commands available with
DataAdapter ?
|
|
The SqlDataAdapter has
§ SelectCommand
§ InsertCommand
§ DeleteCommand
§ UpdateCommand
|
§
10.
|
What is the difference between an ADO.NET Dataset and an ADO
Recordset?
|
|
§ Dataset can fetch
source data from many tables at a time, for Recordset you can achieve the
same only using the SQL joins.
§ A DataSet can represent
an entire relational database in memory, complete with tables, relations,
and views, A Recordset can not.
§ A DataSet is designed
to work without any continues connection to the original data source;
Recordset maintains continues connection with the original data source.
§ DataSets have no
current record pointer, you can use For Each loops to move through the
data. Recordsets have pointers to move through them.
|
§
11.
|
Which method do you invoke on the DataAdapter control to
load your generated dataset with data?
|
|
DataAdapter’ fill () method is used to fill load the data in
dataset.
|
§
12.
|
What are the different methods available under sqlcommand
class to access the data?
|
|
§
ExecuteReader - Used where one or more records are returned - SELECT
Query.
§
ExecuteNonQuery - Used where it affects a state of the table and no data
is being queried - INSERT, UPDATE, DELETE, CREATE and SET queries.
§
ExecuteScalar - Used where it returns a single record.
§
13.
|
What is a DataSet?
|
|
A DataSet is an in memory representation of data loaded from
any data source.
|
§
14.
|
What is a DataTable?
|
|
A DataTable is a class in .NET Framework and in simple words
a DataTable object represents a table from a database.
|
§
15.
|
What is the data provider name to connect to Access
database?
|
|
Microsoft.Access
|
§
16.
|
Which namespaces are used for data access?
|
|
§
System.Data
§
System.Data.OleDB
§
System.Data.SQLClient
|
§
17.
|
What is difference between Dataset. clone and
Dataset.copy?
|
|
Clone: - It only copies structure, does not copy data.
Copy: - Copies both structure and data.
|
§
18.
|
What is difference between dataset and datareader?
|
|
§
DataReader provides forward-only and read-only access to
data, while the DataSet object can hold more than one table (in other
words more than one rowset) from the same data source as well as the
relationships between them.
§
Dataset is a disconnected architecture while datareader is
connected architecture.
§
Dataset can persist contents while datareader can not
persist contents, they are forward only.
§
19.
|
What is DataAdapter?
|
|
A data adapter represents a set of methods used to perform
a two-way data updating mechanism between a disconnected DataTable and
the database. It aggregates four commands: select, update, insert and
delete command. One adapter can only generate and fill one table in a
DataSet.
|
§
20.
|
What is a Command Object?
|
|
The ADO Command object is used to execute a single query
against a database. The query can perform actions like creating,
adding, retrieving, deleting or updating records.
|
§
21.
|
What is basic use of DataView?
|
|
“DataView” represents a complete table or can be small
section of rows depending on some criteria. It is best used for sorting
and finding data with in “datatable”.
|
§
22.
|
What is the use of Connection Object?
|
|
The ADO Connection Object is used to create an open
connection to a data source. Through this connection, you can access
and manipulate a database.
|
§
23.
|
What are the advantage of ADO.Net?
|
|
§
Database Interactions Are Performed Using Data Commands
§
Data Can Be Cached in Datasets
§
Datasets Are Independent of Data Sources
§
Data Is Persisted as XML.
|
§
24.
|
What is a stored procedure?
|
|
A stored procedure is a precompiled executable object that
contains one or more SQL statements.
A stored procedure may be written to accept inputs and
return output
|
|
|
|
No comments:
Post a Comment