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
データベースを VB6 に正常に接続しました。次に、そのデータベースを DataGrid に表示する方法について助けが必要です。
答え1
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