Monday, October 20, 2008

ADO.Net Interview (1-6)Question And Answers

ADO.Net Interview (1-6)Question And Answers

1. What is ADO.NET?
Ans:Expansion of ADO.NET is ActiveX Data Objects. Set of classes that expose primary relational data access services to the Microsoft
.NET based Applications. Easy-to-use yet extensible technology for adding database connectivity to Web pages. Provides interface to access, manipulate, and exchange data in the
.NET Framework. Works with any component on any platform which understands XML. Should not be confused with ADO.
It is the next generation of ADO.

2. What is DataSet?
Ans:Disconnected cache of records retrieved from the data source and works like a virtual data store.Similar to that of a relational database A dataset includes one or more tables in the actual database.Contains information about the relationships between the tables and constraints on what data the tables contain. Fundamental parts of a dataset are exposed through standard programming constructs such as properties and collections.
For example: The DataSet class includes the Tables collection of data tables and the Relations collection of DataRelation objects.

3.Define different execute methods of ADO.NET command object?

Ans:1.ExecuteScalar : Returns a single value from the first row and first column of the result got from the execution of SQL query.
2.ExecuteNonQuery : Executes the DML SQL query just like insert, delete or update and then returns the number of rows affected by the action.
3.ExecuteReader : Returns DataReader object which is a forward-only resultset.
4.ExecuteXMLReader : Available for SQL Server 2000 or later. Upon execution it builds XMLReader object from standard SQL query.

4. Which DataAdapters are available for use with different Databases in ADO.NET?
Ans:ADO.NET makes these data adapters available for use with databases:
OleDbDataAdapter - suitable for use with any data source exposed by an OLE DB provider.
SqlDataAdapter - specific to SQL Server. Because it does not have to go through an OLE DB layer, it is faster than the OleDbDataAdapter. However, it can only be used with SQL Server 7.0 or later.
OdbcDataAdapter - optimized for accessing ODBC data sources.
OracleDataAdapter - optimized for accessing Oracle databases.

6. What is the use of DataAdapter Class?
Ans:1.represents a set of SQL commands and a database connection that are used to fill the DataSet and update the data source.
2.serves as a bridge between a DataSet and a data source for retrieving and saving data.
3.used to exchange data between a data source and a dataset. In many applications, this means reading data from a database into a dataset, and then writing changed data from the dataset back to the database.

No comments:

Labels

Blog Archive