如何以编程方式打开MS Access 2007密码保护的数据库? [英] How to open MS Access 2007 Password Protected Database Programatically ?
问题描述
因为我是c ++的新手。我很难连接MS Access 2007密码保护数据库程序化。
如果我删除了我的2007 Access数据库的密码,我可以获取数据库中的所有记录。但是,如果我为我的MS Access 2007包含密码,我收到错误无法打开数据库。它可能不是您的应用程序识别的数据库,或文件已损坏。请帮我解决这个问题。
以下代码是我正在使用的cdatabase的开放方法
Hi ,
As i am new to c++ . I am stuck up in connecting to MS Access 2007 Password Protected Database Programmatic-ally .
If i remove the password of my 2007 Access Database , I can fetch all the record in the database . But if i include a password for my MS Access 2007 , i am receiving the error " Cannot open database . It may not be the database that your application recognizes , or the file is corrupted". Please help me in resolving the issue.
Following code is the open method of cdatabase which i am using
LPCTSTR lpszConnect =
_T("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DSN='';DBQ=C:\\a.mdb;Pwd=123");
result = db.Open(NULL,false,false,lpszConnect);
请帮我解决问题。
Please help me in resolving the problem .
推荐答案
使用以下连接字符串
Use following connection string
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Jet OLEDB:Database Password=MyDbPassword;
使用 http://connectionstrings.com/ [ ^ ]获取所需的连接字符串。
Use http://connectionstrings.com/[^] to get the connection string you need.
这篇关于如何以编程方式打开MS Access 2007密码保护的数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!