我正在尝试在 Visual BASIC.net 中打开一个数据库。到目前为止,这是我的代码,
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
dbProvider = "PROVIDER=Microsoft.jet.OLEDB.4.0;"
dbSource = "Data Source = C:\Documents and Settings\somar\Desktop\Dropbox\Visual Studio 2010 VB.net\Projects\AddressBook.mbd"
con.ConnectionString = dbProvider & dbSource
con.Open()
MsgBox("Database is now open")
con.Close()
MsgBox("Database is not closed")
End Sub
发生错误我尝试单击按钮。VB 说它无法找到文件的路径。我已将位置更改为桌面,但这并没有太大变化。我不知道为什么会发生这种情况,不帮助你非常感激。
我对编程相当陌生。
谢谢