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.