DataGridView is Empty

iceberg100

New member
Joined
Mar 10, 2006
Messages
2
Programming Experience
1-3
When I start the FORM data won't populate my datagridview - DG_gradilista. What's wrong here??

*** I did not create any database connection in solution explorer.

Public Class Form1
Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source=c:\TOTIC.mdb"
Dim conn As OleDb.OleDbConnection = New OleDb.OleDbConnection(conStr)

Dim sqlStr As String = "SELECT * FROM Gradiliste"
Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(sqlStr, conn)

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ds As DataSet = New DataSet()
da.Fill(ds, "Gradiliste")
DG_gradilista.DataSource = ds.DefaultViewManager

MsgBox = "OK"
End Sub
End Class
 
Back
Top