|
i'm very new to SQL Server and VB.Net 2003
i'm trying to display data on a DataGrid and it's keeps given me an error
this is the code i'm using and i hope someone can help
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
UpdateDataGrid("SELECT * FROM Main")
End Sub
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
UpdateDataGrid("SELECT * FROM Main")
End Sub
Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
dgDisplay.Dispose()
UpdateDataGrid("SELECT * FROM Main")
End Sub
Sub UpdateDataGrid(ByVal sqlStr As String)
Dim dt As New DataTable
Dim connStr As String = "provider=microsoft.jet.oledb.4.0;" & "data source = PriManagement.mdb"
Dim dataAdapter As New OleDb.OleDbDataAdapter(sqlStr, connStr) [COLOR=DarkRed]dataAdapter.Fill(dt)[/COLOR] this is where i get my error :confused:
dataAdapter.Dispose()
dgDisplay.DataSource = dt
End Sub
|