补充,例如,我原来使用打开数据库的代码为
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim str1 As String
Dim str2 As String
Dim str3 As String
str1 = "Provider=Microsoft.Jet.OLEDB.4.0;"
str2 = "Data Source=" + App.Path + "\db1.mdb;"
str3 = "Jet OLEDB:Database Password="
conn.Open str1 & str2 & str3
但这样已经在代码中指定了数据库文件db1.mdb,现在我想用字符串dbname代替db1,应该如何写代码啊?