Vb.net Connection String for Ms Access Database

半腔热情 提交于 2020-01-21 10:30:12

问题


What is the connection string for connecting MS Access 2010 (.accdb) database in VB.net.


回答1:


connectionstrings.com is a wonderful thing:

Standard security

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Persist Security Info=False;

With database password

This is the connection string to use when you have an Access 2007 database protected with a password using the "Set Database Password" function in Access.

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

Some reports of problems with password longer than 14 characters. Also that some characters might cause trouble. If you are having problems, try change password to a short one with normal characters.

DataDirectory functionality

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\myAccess2007file.accdb;Persist Security Info=False;




回答2:


You may use Server Explorer of Visual Studio to get the connection string or take a look at the connection string.




回答3:


www.connectionstrings.com

this is a good site for connection strings for almost any application




回答4:


Did you connect to the database by using 'Tools->Connect to database' ?

If you have already done the above, try this:

Go to server explorer. And select connected database -> In its properties there is a connection string -> Copy it and paste into your code.



来源:https://stackoverflow.com/questions/7830318/vb-net-connection-string-for-ms-access-database

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