ADO.NET - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

ADO.NET

Description:

In this model, data is retrieved from a database and cached on a local machine. ... DataSet does not tie to an underlying representation such as SQL Server or ... – PowerPoint PPT presentation

Number of Views:85
Avg rating:3.0/5.0
Slides: 19
Provided by: ron7
Category:
Tags: ado | net | tie

less

Transcript and Presenter's Notes

Title: ADO.NET


1
ADO.NET
  • Rong Li

2
  • Objectives
  • Over view of ADO.NET
  • Components in ADO

3
What is ADO.NET?
  • ADO.NET which is a data-access component of the
    Microsoft .NET Framework works with any component
    on any platform that understands XML.
  • ADO.NET employs a disconnected database model. In
    this model, data is retrieved from a database and
    cached on a local machine. The data is
    manipulated on a local machine and connect to a
    database only when records are altered or new
    data is acquired.

4
High-level architecture of ADO.NET
Data-Related Components
Managed-provider Components
DataReader
Command
Connection
SQL Server and other OLE DB data store
DataStores
5
  • In the architecture, two distinct groups of
    classes
  • content components
  • managed-provider components

6
content components
  • DataSet
  • DataTable
  • DataView
  • DataRelation

7
DataSet
  • The DataSet can be viewed as an in-memory view
    of a database. It can contain multiple DataTable
    and DataRelation objects. ADO.NET involves
    disconnected datasets, the DataSet object
    provides a number of methods so that all data
    manipulation done to the DataSet can be
    reconciled with a actual database at a later time.

8
DataSet (continue)
  • DataSet does not tie to an underlying
    representation such as SQL Server or Microsoft
    Access, it is portable. Its data format is
    self-described in its schema, and its data is in
    pure XML.

9
DataTable
  • DataTable represents a table of data and thus
    contains a collection of DataColumns and a
    collection of DataRow.

10
DataView
  • Different customized views of a DataTable can be
    created, each with different sorting and
    filtering criteria. Individual records can be
    traversed, searched and edited.
  • In ADO.NET, DataView serves data binding to
    Windows Forms and Web Forms.

11
DataRelation
  • With DataRelation, the relationships between
    DataTable objects can be defined. Client
    components can inspect an individual table or
    navigate the hierarchy of tables through these
    relationships.

12
Managed Providers
  • Managed provider is a term used for a group of
    .NET components that implement a fixed set of
    functionality set forth by the ADO.NET
    architecture. This enforces a common interface
    for accessing data.
  • Microsoft provides two managed providers in its
    current release of ADO.NET OLE DB and SQL. Both
    of them implement a set of interfaces that access
    the appropriate data store.

13
managed-provider components
  • Connection object
  • Command object
  • Data Reader object
  • DataAdapter object

14
Connection object
  • Both OleDbConnection and SqlConnection implement
    System.Data.IDbConnection. Transaction support
    for the ADO.NET connection object has been moved
    to a Transaction object.

15
Command object
  • The command objects are the only way we can make
    execution requests to insert, update, and delete
    data in ADO.NET. All commands are associated with
    a connection object through the SqlCommands or
    the OleDbCommands Connection property. In
    ADO.NET, the result of executing a query command
    is a data reader object or any class implementing
    the IDataReader for custom reading needs.

16
Data Reader object
  • Use a data reader object to access records in a
    forward-only, sequential order. It is efficient.
    Because this is a server-side cursor, the
    connection to the server is open throughout the
    reading of data.

17
DataAdapter object
  • DataAdapter object acts as the bridge between the
    data source and the disconnected DataSet.
  • Each DataAdapter maps only one DataTable in the
    DataSet, but multiple adapters can be filled to

18
  • Steps of a typical usage of data adapter
  • Create a data-adapter object
  • Set up a query string for the internal
    SelectCommand object
  • Set up a connection string for the
    SelectCommands Connection object
  • Set up InsetCommand, UpdateCommand, DeleteCommand
    query string and connection
  • Call Fill() to fill a given dataset with the
    results from a query string
  • Make changes and call the adapters Update()
    method with a changed DataSet
Write a Comment
User Comments (0)
About PowerShow.com