0% found this document useful (0 votes)
8 views

UNIT 4 Data Access in

Uploaded by

sijisag802
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

UNIT 4 Data Access in

Uploaded by

sijisag802
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Data Access in VB.

NET

1
2
ADO.NET
 stands for ActiveX Data Object.
is set of database programming classes(System . Data)
Gives data access services of .NET framework.

Its multilayered architecture.

Includes the concept of data provider .

3
1.Data Provider

2.Connection
SQL Server
3.Command 4.Data Reader Ms Access
Oracle
5.Data Adapter

6.Data Set

XML Output View Representation


of Data

Fig. Architecture of ADO.NET


4
Components of ADO.NET
1. Data Provider
2. Connection
3. Data Adapter
4. Data Reader
5. Data set
6. Command

5
1.Data Provider
 Which is set of special purpose classes used to connect a
database ,execute SQL queries &retrieving results.
 Those results are processed and stored in data set

 Includes connection to the database path.

 There are 3 data provider:

1.Microsoft SQL Server


2.Object Linking and Embedding Database (OLEDB)
3.Open Database Connectivity (ODBC)

6
2.Connection
 Used to interact with data source.

 Establishes a connection between database and Application.

 i.e. used to connect database.

 Work as connection reference in Command and Data Adapter


Objects.

7
3.Command
 Used to execute SQL queries to read ,add , update & delete
data of a data source through Data Adapter
4. Data Adapter
 Is the bridge between a dataset and the connection.

 Provides communication between the data set and the Data


Source.
 Used to retrieve data from a data source & also save changes
made to the dataset back to the data source.
 Data can be transfer to and from the Database into Dataset
by Data Adapter.
 Fill() method of data adapter is used to fill database to
Dataset.

8
5. Data Reader
 Reads the data from data source.

 provides connection oriented data access to the data source

 Connection object can contain only one data Reader at a


time.
 While data is being accessed , the connection in the data
reader remains open & can not used for any other purpose.
 There are 2 types of Data readers

1. SqlDataReader
2. OLEDbReader

9
6. Data Set
 Used to store the data of database in application.

 Represents the collection of data retrieved from the data source.

 Data set is tabular representation of data ,Means represent data in


rows and columns.
 Dataset contains copy of data requested by client.

 Use dataset with data adapter class.

 Dataset contain more than one table at a time.

 Steps to fill Data set:

1.Create connection object.


2.Create adapter by passing query & connection object.
3.Create new object of data set.
4.Call the fill() method of adapter & pass the data set object.

10
Data Table
 Data set is collection of tables , relationship and constraints.

 Used to represent the table in data set.

 Its member of System. Data namespace

11
 Server explorer window appears in left side of the screen.
 Used to connect database.

 Steps to connect database to application:

1. Select data then Add New data source from menu.


2. Choose data source type.
3. Choose data connection
i. Ms Access
ii. ODBC
iii.SQL Server
4. Test the connection.

12
 Used to display whole table/data in data grid.
 Properties of Data Grid:
1.Data source
2.Data Member

17

You might also like