ADO.NET Interview Questions and Answers (445) - Page 2

Which method is used to Gets the name of the specified column using DataReader?

NOTE: This is objective type question, Please click question title for correct answer.
Which method is used to Get a value indicating whether the column contains non-existent or missing values

NOTE: This is objective type question, Please click question title for correct answer.
To improve the performance and scalability of your .NET application. Which one of the following techniques would help?.

NOTE: This is objective type question, Please click question title for correct answer.
Which is the base class for TypedDataset

NOTE: This is objective type question, Please click question title for correct answer.
You are working with a DataSet and want to be able to display data, sorted different ways. How do you do so?

NOTE: This is objective type question, Please click question title for correct answer.
To perform asynchronous data access, what must be added to the connection string?

NOTE: This is objective type question, Please click question title for correct answer.
Which ADO.NET Object's fill method is used to fill the data from database into either DataSet or DataTable?

NOTE: This is objective type question, Please click question title for correct answer.
Which is the default Provider Name of the Providers used to access the DataBase?

NOTE: This is objective type question, Please click question title for correct answer.
Name the classes that are contained in System.Data NameSpace?

DataSet

DataTable
DataColumn
DataRow
DataRealation
Constraint

Stored procedure return more than one resut set and datareader used to fetch record, how you fetch second result set using datareader?

Use DataReader.NextResult()

True - It Check more result remain to read and reader will forward to next result.
False - No more result set found
What is Dataview in ADO Dot Net ?

The DataView provides different views of the data stored in a DataTable. That is we can customize the views of data from a DataTable. DataView can be used to sort, filter, and search the data in a DataTable , additionally we can add new rows and modify the content in a DataTable.

We can create DataView in two ways. Either we can use the DataView constructor, or we can create a reference to the DefaultView property of the DataTable.

DataView dView = new DataView(dTbl);
dView = dataSet.Tables(0).DefaultView;
How can you update the records in database using datareader?

Well, You cannot update. DataReader is just used for reading the data in forward only mode. You can achieve this using Dataset but not by DataReader.
What are the differences between ADO and ADO.NET?

ADO relied on a connection based model . In the connected approach, the client had to be connected with the server and remain connected till the whole procedure or transaction was completed. Time resources and bandwidth became major constraints on such architecture.

To solve this problem the latter version of ADO used RecordSet. All the contents from the data source were copied into RecordSet. This allows clients to get disconnected from the server, work on the RecordSet and copy the changes back to the data source again. This approach did not succeed much because it requires COM marshalling to transmit disconnected data, it support only those datatypes that were defined by the COM standards and hence required type conversion.

ADO.NET can be used to access data sources using new .NET data providers as well as existing OLEDB data providers using the OLEDB.NET data provider.
What are the components of .NET DataProvider?

The .NET DataProvider is a set of components that includes the Connection, Command, DataReader and DataAdapter objects. It is used for connecting to a database , executing commands and retrieving results. Using the .NET data provider we can either access database directly or use the disconnected approach. For the disconnected approach we use DataSet class.

Connection Object:- It is used to connect to the data source. Data source can be any database file. The connection object contains information like the provider name, server name, datasource name, user name and password.

Command Object:- It is used for connect the connection object to a DataReader or DataAdapter object. The command object allow us to execute SQL statement or a stored procedure in a data source.

DataReader Object:- It is used to read the data in a fast and efficient manner from the database. It is generally used to extract one or a few records or specific field values or to execute simple SQL statement.

DataAdapter Object:- It is used to fill data from the database into the DataSet object. it is use din the disconnected approach.
What are the benefits of ADO.NET?

BENEFITS OF ADO.NET


1>Scalability:-
ADO.NET works on DataSet that can represent a whole database or even a data table as a disconnected object and thereby eliminates the problem of the constraints of number of databases being connected. In this way scalability is achieved.

2>Data Source Independence:-
In ADO.NET DataSet is completely independent of data source and no way DataSet is controlled by the data source as it happens in case of RecordSet.

3>Interoperability:-
As ADO.NET transmits the data using the format of XML which is not dependent on ADO.NET or windows platform.

4>Strongly Typed Fields:-
It supports strongly typed fields by using CTS.

5>Performance:-
The performance in ADO.NET is higher in comparison to ADO that uses COM marshalling.

6>Firewall:
As in ADO.NET transmission is via XML format, therefore it can pass through firewalls.
What is the use of DataSet?

DataSet acts as a virtual table. The value is retrieved from the database
and stores in the DataSet. Then we can pass the data to the DataGrid through DataSet.
How to fill DataSet with data?

To fill DataSet with data we have to use Fill() method of DataAdapter object.

Fill() has several overloads. But the simple one is
Fill(DataSet,  DataTable)

The first parameter will take the name of the dataset to be filled and the second parameter specifies the name of the DataTable in the DataSet which will contain the data.
What is a DataSet?

The Dataset is the central object in ADO.NET. DataSet is a logical container of data. It represents a set of data tables referenced as one unit in the application.

With this object you can get all the data you need from each table quickly, examine and change it while you are disconnected from the server and then update the server with changes in an efficient operation.
How to convert a DataSet to a DataReader?

DataTableReader rd = ds.Tables[0].CreateDataReader();
Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories