Excel ADODB VBA 错误消息“不是有效密码”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12037493/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Excel ADODB VBA error msg 'Not a Valid Password'
提问by Developer
I am trying to open a Connection to Password protected AccessDB, through Excel VBA.
我正在尝试通过 Excel VBA 打开到受密码保护的 AccessDB 的连接。
I am using the following connection string
我正在使用以下连接字符串
conn.Provider = "Microsoft.ACE.OLEDB.12.0"
conn.ConnectionString = "Data Source=dbPath; Jet OLEDB:Database Password=pwd;"
where dbPath is the path of accdb/mdb file and pwd is the password to the dbfile. The password is absolutely correct but I am always getting the error "Not a Valid Password". Could someone please guide me in this?? -Sri.
其中 dbPath 是 accdb/mdb 文件的路径,pwd 是 dbfile 的密码。密码绝对正确,但我总是收到错误“密码无效”。有人可以指导我吗?- 斯里。
Additional Info: I am using office 2010 and saved this database as mdb(2003) file(I tried saving this file with accdb extn also). When i am trying to set a password to the database, it shows the msg "Encrypting with a block cipher is incompatible with row level locking. Row level locking will be ignored." Does it have anything to do with the error msg in VBA?
附加信息:我正在使用 office 2010 并将此数据库保存为 mdb(2003) 文件(我也尝试使用 accdb extn 保存此文件)。当我尝试为数据库设置密码时,它显示消息“使用分组密码加密与行级锁定不兼容。行级锁定将被忽略”。它与 VBA 中的错误 msg 有什么关系吗?
回答by
In Access 2010 the encryption method changed for database passwords, and the ADO provider's "Jet OLEDB:Database Password" keyword does not appear to work with the new method. Here, I had to remove the password, go into Access->File->Options->Client Settings->Advanced and check "use legacy encryption", then recreate the password.
在 Access 2010 中,数据库密码的加密方法已更改,并且 ADO 提供程序的“Jet OLEDB:Database Password”关键字似乎不适用于新方法。在这里,我必须删除密码,进入访问->文件->选项->客户端设置->高级并选中“使用旧加密”,然后重新创建密码。
I do not know if there are any new OLE DB connection string keywords for the ACE provider or whether this problem also occurs when using ADO.NET
不知道ACE provider有没有新的OLE DB连接字符串关键字,或者使用ADO.NET时是否也出现这个问题
回答by Developer
Or you could do this.
或者你可以这样做。
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & dbPath & ";Jet OLEDB:Database Password=" & pwd