Sei sulla pagina 1di 12

ADO .

Net Interview Questions


1) Explain about ADO.NET and its features?
ADO.NET features are included in the Microsoft.NET framework. It has software
components which help in data access and services. This can be used to make changes to
RDBMS and non relational data base systems. This technology is considered to be the
forefront of Active X data objects.

2) Explain about Active X data objects?


Active X data objects are used to access data sources and it is based upon the Component
object model. This technology allows data base developers to write program without the
knowledge of how database is implemented. Knowledge of SQL is absolutely not
necessary to write programs in ADO.

3) What are the different languages which implement ADO?


There are several languages which implement ADO technology out of which these are
some of the basic they are VB script in ASP, Visual Basic, Delphi, C++, and Microsoft
environments. ADO.NET is a new addition to ADO.

4) State some of the basic steps required to access and manipulate data?
Some of the basic steps which should be taken to access and manipulate data are as
follows.
* Creating connection object which helps to connect to a database.
* Record set object should be created which facilitates connection to receive data.
* Opening of the connection
* Passing the desired name for your table and performing necessary functions on the
fetched data.
* Changes can be done by using the commands update and update batch.

5) Name some of the top level objects which ADO consists?


Some of the several objects which ADO consists are as follows they are
* Connection object is responsible for creating a connection to the database.
* Record object represents data which is not from the database.
* Parameter object represents a sql parameter
* Stream object is responsible to represent data from a text page or web page.

6) Explain about RDO?


A remote data object is also called as RDO in short. This represents data access
application programming interface used in operating systems of windows. This was
primarily designed for visual basic applications. This feature allows data base developers
to interact directly with Open data base connectivity.

7) Explain about Data access objects or DAO?


DAO is used for database access on windows platform. It creates a work space object in
which applications or operations are performed. There are two types of database engines
they are Jet database engine and ODBC direct database engine.
8) Explain about data provider?
ADO.NET has two primary parts in its architecture out of which one is data provider. It
has its own set of objects and it consists of its own classes. Some of them are connection,
parameter, data reader, command and data adapter. This provides access to data sources
such as Oracle, SQL server, etc.

9) Explain about the command Data reader?


This feature should be used when you have a long list of results and you need to process
one at a time. It provides only two features which is read and forward only. Records
should be accessed sequentially. Previously accessed records cannot be accessed again.

10) Explain about LINQ?


Language integrated query or LINQ provides developers to query data. It uses strongly
typed queries and results. Developer productivity increases by the usage of compile time
error checking and intellisense. This feature is common on number of data types.

11) Explain about Data services?


ADO.NET has number of combinations of patterns and resources of libraries. This
creates a feature which integrates data services with web. It contains formats which
represent data such as JSON and plain XML. This form of interaction enables developers
to interact with normal http commands.

12) Explain LINQ to Entities?


This feature allows LINQ query capabilities and it specifically forms a part of the .NET
framework. This feature allows developers to program in ADO.NET and ORM. This
feature also allows access to third party database. This provides new features to entity
data.

13) Explain about command builder class feature?


Implementation of INSERT, DELETE and UPDATE commands is automatic and this
class provides the necessary automation. You cannot extend or change the command
builder while keeping the base algorithm intact to create action statements.

14) Explain about Db enumerator?


This base class is added to ADO.NET 2.0. This class facilitates the process of obtaining a
list of data sources. SQL server returns instances that are available on the network.
Programmers do have choice of tools in their hands with this feature.

15) How can you find a problem in the data stack?


Problem can arise from these following instances they are: -
1) Mismatch of schema between the client and database.
2) Network library problems or non existence of data.
3) Wrong SQL generated.
4) Wrong programming logic.
16) Compare and explain about ADO.NET and Visual Stuidio.NET?
If you are planning to create specialized sub classes of the data set then it is better to use
visual studio as it has features supporting database schema. Access can be obtained to
each field through strongly types properties. Intellisense is much helpful.

17) Explain about the relationship of XML and ADO.NET?


ADO.NET utilizes the power of XML by providing disconnected access to data. This is
designed with the help of XML classes in .NET Framework which form the components
of single architecture.

What is a DataSet?
Posted by: Abhisek | Show/Hide Answer
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 fill DataSet with data?


Posted by: Abhisek | Show/Hide Answer
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 the use of DataSet?


Posted by: Abhisek | Show/Hide Answer
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.

What are the benefits of ADO.NET?


Posted by: Abhisek | Show/Hide Answer
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 are the components of .NET DataProvider?


Posted by: Abhisek | Show/Hide Answer
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 differences between ADO and ADO.NET?


Posted by: Abhisek | Show/Hide Answer
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.

How can you update the records in database using datareader?


Posted by: Virendradugar | Show/Hide Answer
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 is Dataview in ADO Dot Net ?


Posted by: Chikul | Show/Hide Answer
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;
Stored procedure return more than one resut set and datareader used to
fetch record, how you fetch second result set using datareader?
Posted by: Bprasad | Show/Hide Answer
Use DataReader.NextResult()

True - It Check more result remain to read and reader will forward to next result.
False - No more result set found

Name the classes that are contained in System.Data NameSpace?


Posted by: Syedshakeer | Show/Hide Answer
DataSet

DataTable

DataColumn

DataRow

DataRealation

Constraint

Name the classes are found in System.Data.Common NameSpace?


Posted by: Syedshakeer | Show/Hide Answer
1)DataColumnMapping

2)DataTableMapping

To add a new row in DataTable, we can use NewRow() method of the DataTable object.
(Here assume that there are two columns Name, Address in the DataTable.

DataTable dTable = new DataTable();

DataRow row = null;

for (int i = 0; i < 5; i++)

row = dTable.NewRow ();

row["Name"] = i + " - Raja";

row["Address"] = "USA";
dTable.Rows.Add(row);

Difference between OLEDB Provider and SqlClient ?


Posted by: Babu_akkandi | Show/Hide Answer
SQLClient .NET classes are highly optimized for the .net / sqlserver combination and
achieve optimal results. The SqlClient data provider is fast. It's faster than the Oracle
provider, and faster than accessing database via the OleDb layer. It's faster because it
accesses the native library (which automatically gives you better performance), and it
was written with lots of help from the SQL Server team.

What are the advantage of ADO.Net?


Posted by: Babu_akkandi | Show/Hide Answer
• ADO.NET Does Not Depend On Continuously Live Connections
• Database Interactions Are Performed Using Data Commands
• Data Can Be Cached in Datasets
• Datasets Are Independent of Data Sources
• Data Is Persisted as XML
• Schemas Define Data Structures

Explain about Data access objects or DAO?


Posted by: Neeks | Show/Hide Answer
DAO is used for database access on windows platform. It creates a work space object in
which applications or operations are performed. There are two types of database engines
they are Jet database engine and ODBC direct database engine.

Explain about the relationship of XML and ADO.NET?


Posted by: Neeks | Show/Hide Answer
ADO.NET utilizes the power of XML by providing disconnected access to data. This is
designed with the help of XML classes in .NET Framework which form the components
of single architecture.

Name some of the top level objects which ADO consists?


Posted by: Neeks | Show/Hide Answer
1. Connection object is responsible for creating a connection to the database.
2. Record object represents data which is not from the database.
3. Parameter object represents a sql parameter
4. Stream object is responsible to represent data from a text page or web page.

How to create a DataView from DataTable?


Posted by: Raja | Show/Hide Answer
In order to create a DataView from a DataTable, use instantiate the DataView object by
passing DataTable as parameter in the constructor.

eg.
DataView dView = new DataView(dTable);

Can DataAdapter object accept DataTable as parameter in Fill method?


Posted by: Raja | Show/Hide Answer
Yes,

DataAdapter object can accept either DataTable or DataSet as parameter to fill data from
database.

eg.
SqlDataAdapter dAd = new SqlDataAdapter();

DataTable dTable = new DataTable();

DataSet dSet = new DataSet();

----

---

dAd.Fill(dTable); // will also work

dAd.Fill(dSet); // will also work

We should only use DataSet as parameter when we are expecting more than one result set
is being returned from database.
What is a Linked Server?
Posted by: Neeks | Show/Hide Answer
A linked server configuration enables SQL Server to execute commands against OLE DB
data sources on remote servers. Linked Servers is a concept in SQL Server by which we
can add other SQL Server to a Group and query both the SQL Server dbs using T-SQL
Statements.
Linked servers offer the following advantages:

1. Remote server access.


2. The ability to issue distributed queries, updates, commands, and transactions on
heterogeneous data sources across the enterprise.
3. The ability to address diverse data sources similarly.

With a linked server, you can create very clean, easy to follow, SQL statements that
allow remote data to be retrieved, joined and combined with local data. Stored Procedure
sp_addlinkedserver, sp_addlinkedsrvlogin will be used add new Linked Server.

If you have more than one lakh rows in database table,while printing
that table in frontend performence will be degraded. for that
what do you do to improve the performence?
Posted by: Goud.ranjith | Show/Hide Answer
increase the execution time out in web.config (or)increase the connection time out in
connection string

What is the purpose of connection pooling in ADO.NET?


Posted by: Majith | Show/Hide Answer
Connection pooling enables an application to use a connection from a pool of
connections that do not need to be re-established for each use. Once a connection has
been created and placed in a connection pool, an application can reuse that connection
without performing the complete connection creation process.

Diff Data Grid and Repeater


Posted by: Majith | Show/Hide Answer
Datagrid is
* one which has advanced features and lets you do lot many things like paging and
sorting your data without much effort.
* DataGrid can hold text data, but not linked or embedded objects.
Whereas a DataRepeater is
* which does not have the paging feature but we can do it by coding.
* one which can hold other controls and can embed objects.
* It can embed a Datagrid within it but not viceversa.

Apart from this a Data Repeater


--is used in places where you need more control over the rendering of your data
-- have very flexible templates that give you total control over the formatting of your data

1. Why are Server control tags shown in the browser instead of the controls it
represents?

This is because the server control tags were not converted into their respecting
HTML element tags by ASP.Net. This happens when ASP.Net is not properly
registered with IIS. .Net framework provides an Administration utility that
manages the installation and uninstallation of multiple versions of ASP.NET on a
single machine. You can find the file in
C:\WINNT\Microsoft.NET\Framework\v**\aspnet_regiis.exe use the command:
aspnet_regiis.exe -u ---> to uninstall current asp.net version. use the command:
aspnet_regiis.exe -i ---> to install current asp.net version

2. What are the Best practices for side-by-side execution of Framework 1.1 and
2.0?

In ASP.NET, applications are said to be running side by side when they are
installed on the same computer, but use different versions of the .NET
Framework.

3. Can I have VS.NET and the Visual Studio 6.0 installed on the same machine?

Yes! VS.Net works with the .Net framework, while VS6.0 works with MFC or
the Windows API directly, for the most part. They can be installed and run on the
same machine without any considerations.

4. What is Assembly name and name space?

An assembly is a logical unit of code. Physically it may exist as dll or an exe.


which can contain one or more files and they can be any file types like image
files, text files etc. along with DLLs or EXEs.When you compile your source
code by default the exe/dll which is generated is actually an assemblyand every
assembly file contains information about itself which is called as Assembly
Manifest.Namespace is an abstract container providing context for the items it
holds and allows disambiguation of items having the same name (residing in
different namespaces. It can also be said as a context for identifiers. So under a
namespace you can have multiple assemblies.

5. what is capacity of dataset?

DataSet is logical represantation of database so it can store as much as database.

6. What is deployment? How do you deploy .Net and Java applications

Deployment - It is the procedure to deploy Web Application on the Server. You


can deploy .Net application by simply Xcopy and create virtual directory for the
application on server.

7. Where this DataSet is Stored?

Dataset is an in-memory representation of a database. Its stored no where but in


memory. Goes off when GC stats after a littl sleep.

8. How different are interface and abstract class in .Net?

When a class is not provided with full functionalitythen it is declared as abstract.it


doesn't support instance creation as well as it cannot be overridable to child
class.interface is a colection of methods only without functionality.interface is
90% same as abstract class.

9. How does vs.net 2005 support biztalkserver?

if you install biztalk server it provides Biztalk Project in the project types like
webproject, windows project, console project. We use rest of the products of the
Biztalk like adapters and all those thing and use them in .net.

10. what is marshling?

Marshaling performs the necessary conversions in data formats between managed


and unmanaged code.CLR allows managed code to interoperate with unmanaged
code usining COM Marshaler(Component of CLR).

11. Can you explain the difference between an ADO.NET Dataset and an ADO
Recordset?
o A DataSet can represent an entire relational database in memory, complete
with tables, relations, and views.
o A DataSet is designed to work without any continuing connection to the
original data source.
o Data in a DataSet is bulk-loaded, rather than being loaded on demand.
o There's no concept of cursor types in a DataSet.
o DataSets have no current record pointer You can use For Each loops to
move through the data.
o You can store many edits in a DataSet, and write them to the original data
source in a single operation.
o Though the DataSet is universal, other objects in ADO.NET come in
different versions for different data sources.
12. In .NET Compact Framework, can I free memory explicitly without waiting
for garbage collector to free the memory?

.NET Compact Framework come with CLR which perform automatic garbage
collector to free the memory without using destector(perform garbage collector
when is declear)

Potrebbero piacerti anche