Upload
nazirbook
View
216
Download
0
Embed Size (px)
Citation preview
7/28/2019 Lecture-01 Introduction ADO.net
1/11
Modern Programming Language
Lecture-01
7/28/2019 Lecture-01 Introduction ADO.net
2/11
ADO.NET (ActiveX
Data Objects)ADO.NET consists of a set of objects that interact
to provide the interaction with physical data store.
A simplified view of the primary objects in theADO.NET object model.
7/28/2019 Lecture-01 Introduction ADO.net
3/11
The ADO.NET classes are divided into twocomponents:
The Data Providers (sometimes called ManagedProviders), which handle communication with aphysical data store,
And the DataSet, which represents the actual data.Either component can communicate with dataconsumers such as WebForms and WinForms.
7/28/2019 Lecture-01 Introduction ADO.net
4/11
Data Providers The Data Provider components are specific to a
data source. The .NET Framework includes two Data Providers
A generic provider that can communicate with anyOLE DB data source,
And a SQL Server provider that has been optimizedfor Microsoft SQL Server
The two Data Providers included in the .NETFramework contain the same objects, although
their names and some of their properties andmethods are different.
The SQL Server provider objects begin with SQL(for example, SQLConnection), while the OLE DBobjects begin with OleDB (for example,OleDbConnection).
7/28/2019 Lecture-01 Introduction ADO.net
5/11
Connection object
The Connection object represents the physicalconnection to a data source.
Its properties determine the data provider (in thecase of the OLE DB Data Provider), the data
source and database to which it will connect, andthe string to be used during connecting.
Its methods are fairly simple: You can open andclose the connection, change the database, and
manage transactions.
7/28/2019 Lecture-01 Introduction ADO.net
6/11
Command object
The Command object represents a SQL statementor stored procedure to be executed at the datasource.
Command objects can be created and executed
independently against a Connection object, andthey are used by DataAdapter objects to handlecommunications from a DataSet back to a datasource.
Command objects can support SQL statementsand stored procedures that return single values,one or more sets of rows, or no values at all.
7/28/2019 Lecture-01 Introduction ADO.net
7/11
DataReader object
A DataReader is a fast, low-overhead object for
obtaining a forward-only, read-only stream of datafrom a data source.
They cannot be created directly in code; they arecreated only by calling the ExecuteReader method
of a Command object.
7/28/2019 Lecture-01 Introduction ADO.net
8/11
DataAdapter Object
The DataAdapter is functionally the most complexobject in a Data Provider. It provides the bridgebetween a Connection and a DataSet.
The DataAdapter contains four Command objects:
SelectCommand
UpdateCommand
InsertCommand
DeleteCommand
The DataAdapter uses the SelectCommand to filla DataSet and uses the remaining threecommands to transmit changes back to the datasource,
7/28/2019 Lecture-01 Introduction ADO.net
9/11
DataSets Object
The DataSet is a memory-resident representation of
data.
The DataSet can be considered a somewhat simplifiedrelational database, consisting of tables and theirrelations. however,
the DataSet is always
disconnected from
the data source.
7/28/2019 Lecture-01 Introduction ADO.net
10/11
The DataSet is composed of two primary objects: .
DataTableCollection: The DataTableCollectioncontains zero or more DataTable objects . whichare in turn made up of three collections: Columns,Rows, and Constraints.
DataRelationCollection. The DataRelationCollectioncontains zero or more DataRelations.
Binding Data to a Simple Windows Form
7/28/2019 Lecture-01 Introduction ADO.net
11/11
Questions???