VB6: Как показать SQLite в DataGrid
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