我正在寻找一个简单的例子来说明如何使用VS2012下的vb.net连接到SQLite数据库。我已经从SQLite.org下载并安装了SQLite dll,并且可以访问SQLite名称空间。需要访问的应用程序正在使用XAML / VB.Net在Visual Studio 2012中实现。一个示例包括说明连接,访问和访问现有表的过程的所有导入引用就足够了。
答案 0 :(得分: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