我在同一工作区中有一个数据库,我尝试使用以下代码连接到此数据库:
Dim CX As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & "./Learning.mdb")
Dim CX As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & "~/Learning.mdb")
Dim CX As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & "~Learning.mdb")
但它们都不起作用。
答案 0 :(得分:4)
尝试:
Dim CX As OleDbConnection = New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" &
System.AppDomain.CurrentDomain.BaseDirectory & "/Learning.mdb")