VB6 MS access driver connection string using label or variable

StackOverflow https://stackoverflow.com/questions/20301752

  •  06-08-2022
  •  | 
  •  

سؤال

by default MS access connection string is

connection = "Driver={Microsoft Access Driver (*.mdb)};" & _
    "dbq=Database1.mdb;" & _
    "DefaultDir=E:\somepath;" & _
    "uid=Admin;Pwd=;"

and i want use label to get database path info

connection = "Driver={Microsoft Access Driver (*.mdb)};" & _
    Chr(34) & "dbq=" & lblF.Caption & ";" & Chr(34) & _
    Chr(34) & "DefaultDir=" & LocL.Caption & ";" & Chr(34) & _
    "uid=Admin;Pwd=;"

but it's fail :(

لا يوجد حل صحيح

نصائح أخرى

Remove all the Chr() calls. You don't need to insert any double quotes in this connection string.

i.e.

connection = "Driver={Microsoft Access Driver (*.mdb)};" & _
             "dbq=" & lblF.Caption & ";" & _
             "DefaultDir=" & LocL.Caption & ";" & _
             "uid=Admin;Pwd=;"
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top