VB.net Tutorials with Examples

VB.Net Projects

VB.Net Project 1

adplus-dvertising
How to EDIT/UPDATE/CANCEL/DELETE in Gridview
Previous Home Next

Introduction This article explains the methods of binding Asp.Net GridView control with simple DataSet or DataTable, and also explains the methods like Insert, Edit, Update and Delete function in the GridView control.

Design of Gridview

Simple DataBind in Gridview

Public Sub bindgrid()
	Dim con As OleDbConnection
	Dim da As OleDbDataAdapter
	con = New OleDbConnection(
	"provider=microsoft.jet.oledb.4.0;Data source=D:\invent.mdb")
	da = New OleDbDataAdapter(
	"select item_id, Item,tax from purchase", con)
	Dim ds As New DataSet()
	da.Fill(ds, "purchase")
	GridView1.DataSource = ds.Tables(
	"purchase")
	GridView1.DataBind()
End Sub

How to Call bindgrid Method

Public Sub bindgrid()
	Dim con As OleDbConnection
	Dim da As OleDbDataAdapter
	con = New OleDbConnection(
	"provider=microsoft.jet.oledb.4.0;Data source=D:\invent.mdb")
	da = New OleDbDataAdapter(
	"select item_id, Item,tax from purchase", con)
	Dim ds As New DataSet()
	da.Fill(ds, "purchase")
	GridView1.DataSource = ds.Tables(
	"purchase")
	GridView1.DataBind()
End Sub
Previous Home Next