Unit 4
Unit 4
Unit 4
NET
UNIT-4
INTRODUCTION
• It is a model used by .NET applications to communicate with
a database for retrieving, accessing and updating data.
• It supports applications that need to communicate with a
database for retrieving data and presenting it in a
user-friendly format.
• All the ADO.NET classes are located
into System.Data.dll and integrated with XML classes
located into System.Xml.dll.
• ADO.NET has two main components that are used for
accessing and manipulating data are the .NET Framework
data provider and the DataSet.
Features
• Disconnected Data Architecture
• Data cached in datasets
• Data Transfer in XML Format
• Interaction with database is done through
data commands.
ADO.Net Object Model
DATA PROVIDER
Executes command to
Command retrieve data
Accessing DATABASE
Retrieved Data
Transfers data to the
dataset and reflects
changes in the
database
DATASOURC
CURRENCYMANAGER1 E1
CURRENCYMANAGER3 DATASOURC
E3
CODE TO NAVIGATE
Private Sub Next_Click(sender As Object, e As EventArgs) Handles Button2.Click
bm.Position += 1
TextBox1.Text = EMP1DataSet1.Tables("emp").Rows(bm.Position).Item(0)
TextBox2.Text = EMP1DataSet1.Tables("emp").Rows(bm.Position).Item(1)
End Sub
Private Sub Previous_Click(sender As Object, e As EventArgs) Handles Button3.Click
bm.Position = bm.position -1
TextBox1.Text = EMP1DataSet1.Tables("emp").Rows(bm.Position).Item(0)
TextBox2.Text = EMP1DataSet1.Tables("emp").Rows(bm.Position).Item(1)
End Sub
Private Sub First_Click(sender As Object, e As EventArgs) Handles Button1.Click
bm.Position = 0
TextBox1.Text = EMP1DataSet1.Tables("emp").Rows(bm.Position).Item(0)
TextBox2.Text = EMP1DataSet1.Tables("emp").Rows(bm.Position).Item(1)
End Sub
WINDOWS
APPLICATION DATAVIEW2 DATA TABLE
DATAVIEW3
FILTER1
Properties of Data View
• Table- to specify the data table to which data view
would refer
• Sort- to specify expression on which records will
be sorted
• RowFilter- to specify expression to filter the
records
• RowStateFilter- to specify the version of the
record that is current or original
• AllowNew, AllowDelete, AllowEdit – whether the
records can be added, deleted or edited.
Program
• Private sub FrmSelect_Load()
OleDbDADataview.Fill(DSDataview)
Dim dv as DataView= new
DataView(DSDataview.Tables(“Product”))
dv.rowfilter=“Base_cost>2500”
dv.sort=“ProdId DESC”
lbprodid.Datasource=dv
lbprodid.DisplayMember=“ProdId”
End Sub