Nelson9
09-06-2009, 10:04 AM
I am a complete newbie to asp.net.I am trying to create gridview using code.
But when i run the program i get blank page nothing else.Here is the code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim constr As String
Dim data As OleDbDataAdapter
Dim GridView1 As New GridView
Dim ds As New DataSet
constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\db.mdb"
Dim con As New OleDbConnection(constr)
con.Open()
data = New OleDbDataAdapter("select * from Table1", con)
data.Fill(ds)
GridView1.DataSource = ds.Tables("Table1")
GridView1.DataBind()
End Sub
But when i run the program i get blank page nothing else.Here is the code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim constr As String
Dim data As OleDbDataAdapter
Dim GridView1 As New GridView
Dim ds As New DataSet
constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\db.mdb"
Dim con As New OleDbConnection(constr)
con.Open()
data = New OleDbDataAdapter("select * from Table1", con)
data.Fill(ds)
GridView1.DataSource = ds.Tables("Table1")
GridView1.DataBind()
End Sub