1

我正在寻找一个简单的示例来说明如何在 VS2012 下使用 vb.net 连接到 SQLite 数据库。我已经从 SQLite.org 下载并安装了 SQLite dll,并且可以访问 SQLite 命名空间。需要访问的应用程序正在使用 XAML/VB.Net 在 Visual Studio 2012 中实现。一个包含所有导入引用的示例,说明连接、访问和访问现有表的过程就足够了。

4

1 回答 1

0
 Private Sub FrmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    constr = "Data Source=" & Application.StartupPath & "\latihan.db;"
    Dim cn As New SQLiteConnection(constr)
    Try
        cn.Open()
    Catch ex As Exception
        cn.Dispose()
        cn = Nothing
        MsgBox(ex.Message)
        Exit Sub
    End Try

    Dim dt As New DataTable
    Try
        dafill("select*from member order by nama", dt, cn)
        DataGridView1.DataSource = Nothing
        DataGridView1.DataSource = dt
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
    dt.Dispose()
    dt = Nothing
    cn.Close()
    cn.Dispose()
    cn = Nothing
End Sub
于 2020-11-23T13:31:21.167 回答