I have made an another simple program to make connectivity with MS ACCESS. I have use gridview to display my data.
1) Import this files:
Imports System
Imports System.Data
Imports System.Data.OleDb
2) Make decleration of variables and objects:
Dim strConn As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("~/App_Data/db2.mdb") & ";"
Dim conn As OleDb.OleDbConnection
Dim cmd As OleDb.OleDbCommand
Dim rdr As OleDb.OleDbDataReader
Dim strsql As String
3)In page load event write down:
conn = New OleDb.OleDbConnection(strConn)
conn.Open()
strsql = "select * from stud"
cmd = New OleDb.OleDbCommand(strsql, conn)
rdr = cmd.ExecuteReader()
GridView1.DataSource = rdr
GridView1.DataBind()
rdr.Close()
conn.Close()
Search
Showing posts with label Asp.net database connectivity. Show all posts
Showing posts with label Asp.net database connectivity. Show all posts
Sunday, February 28, 2010
Subscribe to:
Posts (Atom)