Private Sub Form_Load()
Dim sqlstr As String
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
Dim rs As New ADODB.Recordset
Set conn = New ADODB.Connection
conn.ConnectionString = "DRIVER=SQLite3 ODBC Driver;Database=" & App.Path & "/database.db;"
conn.Open
rs.Open "SELECT * FROM tblGiat", conn, adOpenKeyset
MsgBox "Total Number of records = " & rs.RecordCount
End Sub
Ich habe die Datenbank erfolgreich mit VB6 verbunden. Jetzt brauche ich Hilfe, wie ich diese Datenbank in DataGrid anzeigen kann.
Antwort1
Private Sub Form_Load()
Dim sqlstr As String
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
Dim rs As New ADODB.Recordset
Set conn = New ADODB.Connection
conn.ConnectionString = "DRIVER=SQLite3 ODBC Driver;Database=" & App.Path & "/database.db;"
conn.Open
rs.Open "SELECT * FROM tblGiat", conn, adOpenKeyset
MsgBox "Total Number of records = " & rs.RecordCount
Set DataGrid1.DataSource = rs
End Sub