Anda di halaman 1dari 3

ADO .

NET
1. What is ADO.Net? What is ADO.Net object model or architecture? Explain it in
details.
ADO.NET is a easy-to-use, a faster & more efficient data access technology for
building database applications for Windows & the Web. This technology provides a userfriendly interface for accessing data in any type of database & accessible to developers
coding in most any type of language.
ADO.NET is a set of highly object-oriented, extensible library of classes for accessing
& manipulating database. The data can be form SQL server, Oracle, Text files on your
disk, XML streams, or virtually any where else. ADO.NET provides a rich set of
components for creating distributed, data-sharing applications.
ADO.Net object model or architecture

(1) TheConnection object provides connectivity to a data source. The connection object
represents the physical connection to a data source (database).Using its method, you
can open & close the connection, change the database & manage transactions.
(2) TheCommand object is used to execute SQL statements (Select, Insert, Update &
Delete) as well as stored procedure. Command objects can be created & executed
independently against a Connection object, and they are used by DataAdapter and
TableAdapter objects to handle a communications between a DataSet & data source.
(3) TheDataAdapter object provides the bridge between the DataSet object and the
data source (database) for retrieving and saving data.The DataAdapters sole purpose
is to retrieves data from the database, then populates (fill) the Datasets & also used to
send (propagate) the Datasets changes to the database.
(4) The DataReader in addition to datasets, there are also datareaders, which are
extremely fast, read-only, forward only low-overhead way of retrieving information from
Prepared By Vimal Vaiwala
SDJ INTERNATIONAL COLLEGE

ADO .NET
the database.You can only move through records with in ascending order. It provides a
high-performance stream of data from the data source (database). If we only need single
direction, read only loading of DataSets or controls, we can bypass the Adapter entirely &
utilize a DataReader. DataReader cannot be created directly in code; they are created only
by calling the ExecuteReader method of a Command object.
Data Set Class
The Data Set provides the basis for disconnected storage and manipulation of relational
data.
You can fill it from a Data source, work with it while disconnected from that Data
source, then reconnect and flush changes back to the data source as required.
There are two ways to use DataSet: fill it with data from an existing data store or
create your own empty DataSet from scratch.
The main difference between Dataset and ADO record set are:
1) The Dataset class can hold more than one table as well as relationship between them.
2) The Dataset class automatically provides disconnected access to data.
Dataset work independently of the original Data source of the data.
There is no SQL Dataset or Oledb Dataset
You cant connect Dataset directly to a database or other source of data.
You can use a DataAdapter object to move data between Dataset and Datasource.
2. Difference between ADO and ADO.NET
ADO
ADO.NET
It works in connected scenario.
It works in disconnected scenario.
ADO use OLEDb. All data access works ADO.NET works with both OLEDb and
against OLEDb provider.
non-OLEDb provider and ships with SQL
Server. .NET data provider, which does not
involve OLEDb.
ADO holds only one result set. There is ADO.NET data set class hold multiple
always to create multiple unrelated result tables of data in DataTable object. It even
set but it is much less useful
supports relationship and views based on
the DataTable.
ADO has no such support.
ADO .NET directly supports the execution
of query resulting a single value without
the need to create a dataset.
ADO has very limited support for XML.
ADO.NET has rich support for moving
data between its dataset and XML file and
schema.0
ADO allows you to create client-side ADO.NET gives you the choice of either
cursors only
using client-side or server-side cursors.
ADO works with connected data. This ADO.NET uses data in a disconnected
means that when you access data, such as fashion. When you access data, ADO.NET
viewing and updating data, it is real-time, makes a copy of the data using XML.
with a connection being used all the time.
ADO.NET only holds the connection open
long enough to either pull down the data or
Prepared By Vimal Vaiwala
SDJ INTERNATIONAL COLLEGE

ADO .NET
to make any requested updates.
3. What is Data Binding?
It is the process ot attaching the Data source to a data aware control is called as Data
Binding.
.NET supports two types of Data Binding.
(1) Simple Data Binding &
(2) Complex Data Binding.
(1) Simple Data Binding : In Simple Data Binding, only a single value (one data
element) from a DataSet can be bound to control at a time. In this type of Data Binding,
any value from the DataSet can be bound to any property of a control.
(2) Complex Data Binding : In Complex Data Binding, a control is bound to a complete
DataSet (more than one data element) instead of just one column from it.
Most controls support only simple data binding but some controls, such as
DataGridView, ComboBox, ListBox & CheckedListBox support complex data binding.
4. Explain Data Grid.
The DataGridView control provides a powerful and flexible way to display data in a
tabular format. You can use the DataGridView control to show read-only views of a
small amount of data, or if you are enabling a user to edit a table with millions of records,
the DataGridView control will provide you with a readily programmable, memoryefficient solution.
With the DataGridViewcontrol, you can display and edit tabular data from many
different kinds of data sources.
Binding data to the DataGridViewcontrol is straightforward, and in many cases it
is as simple as setting the DataSource property. When you bind to a data source that
contains multiple lists or tables, set the DataMember property to a string that specifies
the list or table to bind to.
Property :
(1) DataSource : Gets or sets the name of data source that the DataGridView is used for
displaying data. The data source can be of DataSet, DataTable etc. For example
DataGridView1.DataSource = DataSet11
(2) DataMember : Gets or sets the name of the table or list of data, the DataGridView
should display. When you bind to a data source that contains multiple lists or tables, set
the DataMemberproperty to a string that specifies the table or list to bind to.
You do not need to set this property when binding to a data source that contains a
single table or list. If the DataSet contains multiple tables, however, you must set this
property to the name of one of the tables.
DataGrid1.DataMember = "Employee"
(3) Columns : By using the DataGridViewColumnCollection returned by this
property, you can add columns, remove columns, and obtain a count of the columns
contained in the DataGridView control.
For example: DataGrid1.Columns.Add(columnName, headerText)

Prepared By Vimal Vaiwala


SDJ INTERNATIONAL COLLEGE

Anda mungkin juga menyukai