Connecting to an Access database that has a database password

久未见 提交于 2019-12-28 18:44:12

问题


I've password protected an mdb file but then I cannot access it on vb.net. I don't know the correct code for defining the password. this is my current code, I know its wrong, but I don't also know the correct code:

conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\search.mdb;pwd=nit"

回答1:


conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Jet OLEDB:Database Password=MyDbPassword;" 

is the correct format for your connection string.

Check out http://www.connectionstrings.com/access-2007 for more info.




回答2:


I believe the connection string should look like this:

conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Jet OLEDB:Database Password=MyDbPassword;"  

Here is a link to a site which can help with connection string questions ConnectionStrings.Com HTH



来源:https://stackoverflow.com/questions/2049017/connecting-to-an-access-database-that-has-a-database-password

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!