GUI Lecture4-2
GUI Lecture4-2
GUI Lecture4-2
PROGRAMMING USING C#
Lecture 4: ADO.NET Architecture
ADO.NET
ADO.NET is the data access technology, which
allows you to access data residing in various data
source.
ADO.NET is a part of the .NET Framework.
ADO.NET technology allows you to connect to
database systems such as Microsoft SQL Server,
Oracle, Microsoft Access.
Data Access Architecture
ADO.NET have two components:
Data provider are used for providing and
form of table
Data Provider
Data provider are used for providing and
maintaining connection to the database.
The .NET Framework provides different data
providers which are listed as follows:
.NET Framework data provider for SQL
Server
.NET Framework data provider for OLE DB
System.Data.OracleClient
System.Data.OleDb
System.Data.Odbc
Data Access Components
ADO.Net provides two components to access and
manipulate data:
.NET Framework data providers
The DataSet
Data Access Components
ADO.NET consists of objects that allows you to
establish connections and work with the database. The
objects associated with ADO.NET technology are:
Command object
Connection object
DataAdpater
DataReader
DataSet
DataProvider
DataSet
DataSet are used to display and update data. It can
be used for retrieving data from multiple sources.
Connection Object
The Connection Object allows you to create a
connection between your application and the
database.
The connection object stores information that is
required to establish the connection.
In ADO.NET you can establish a connection to
SQL Server and OLE DB data source
SqlConnextion Class
OleDbConnection Class
SqlConnection Class
SqlConnection Class is used to connect to an SQL
Server
Name Description
TheConnectionString
table lists the Thiscommonly
property retrievesused properties,
the string, which is
used to open a SQL Server database
methods,
State
and events of the SqlConnection Class
This property retrieves the current state of
the connection
Close This method closes the connection to the
database
CreateCommand This method creates and returns a
SqlCommand object, which is associated
with SqlConnection
Open This method opens a connection to the
database
StateChange This event occurs when the state of the
connection is changed
SqlConnection Class
The Syntax: