如何使用Windows窗体连接受密码保护的访问数据库文件。 [英] How to connect password protected access database file with windows form.
问题描述
< add name =dbinfoconnectionstring =Provider = Microsoft.ACE.OLEDB.12.0; Data Source = | DataDirectory | \ DB\DBInfo.accdb; Persist Security Info = True; Jet OLEDB:Database Password = arthdata123\" > providerName =System.Data.OleDb/>
我尝试过:
当我调试带有数据库错误的Windows应用程序时出现..不是有效的密码。如何正确运行带有密码保护的数据库文件的Windows应用程序。
< configuration>
< configsections>
< connectionstrings>
< add name =dbinfoconnectionstring =Provider = Microsoft.ACE.OLEDB .12.0; Data Source = | DataDirectory | \ DB\DBInfo.accdb; Persist Security Info = True; Jet OLEDB:Database Password = arthdata123>
providerName =System.Data.OleDb />
<add name="dbinfo" connectionstring="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\DB\DBInfo.accdb;Persist Security Info=True;Jet OLEDB:Database Password=arthdata123"> providerName="System.Data.OleDb" />
What I have tried:
when i was debug windows app with database error is comming.."Not a valid password". how can i properly run my windows app with password protected database file.
<configuration>
<configsections>
<connectionstrings>
<add name="dbinfo" connectionstring="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\DB\DBInfo.accdb;Persist Security Info=True;Jet OLEDB:Database Password=arthdata123">
providerName="System.Data.OleDb" />
推荐答案
您的ConnectionString应如下所示
如果您使用.accdb(Access Office 2007)
Your ConnectionString should be as follows
If you are using .accdb(Access Office 2007)
"Provider=Microsoft.ACE.OLEDB.12.0;Data source=yourDatabase.accdb;Jet OLEDB:Database Password=yourPassword"
同样如果您使用* .mdb文件,您的连接字符串应如下所示
Similarly if you are using *.mdb file your connectionstring should be look like as follows
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=yourDatabase;
Jet OLEDB:Database Password=yourPassword;"
这篇关于如何使用Windows窗体连接受密码保护的访问数据库文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!