默认情况下,MS访问连接字符串为
connection = "Driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=Database1.mdb;" & _
"DefaultDir=E:somepath;" & _
"uid=Admin;Pwd=;"
我想使用标签来获取数据库路径信息
connection = "Driver={Microsoft Access Driver (*.mdb)};" & _
Chr(34) & "dbq=" & lblF.Caption & ";" & Chr(34) & _
Chr(34) & "DefaultDir=" & LocL.Caption & ";" & Chr(34) & _
"uid=Admin;Pwd=;"
但它失败了:(
删除所有Chr()调用。您不需要在此连接字符串中插入任何双引号。
即
connection = "Driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=" & lblF.Caption & ";" & _
"DefaultDir=" & LocL.Caption & ";" & _
"uid=Admin;Pwd=;"