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