Ms Access 数据库的 Vb.net 连接字符串

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7830318/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 15:44:57  来源:igfitidea点击:

Vb.net Connection String for Ms Access Database

vb.netconnection-stringms-access-2010

提问by user997611

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

在 VB.net 中连接 MS Access 2010 (.accdb) 数据库的连接字符串是什么。

回答by Jay Riggs

connectionstrings.com is a wonderful thing:

connectionstrings.com 是一件很棒的事情

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;

标准安全

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

有数据库密码

这是当您使用 Access 中的“设置数据库密码”功能使用密码保护 Access 2007 数据库时要使用的连接字符串。

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

一些关于密码超过 14 个字符的问题的报告。此外,某些字符可能会引起麻烦。如果您遇到问题,请尝试将密码更改为具有正常字符的短密码。

数据目录功能

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

回答by adatapost

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

您可以使用Server ExplorerVisual Studio 来获取连接字符串或查看连接字符串。

回答by Sinaesthetic

www.connectionstrings.com

www.connectionstrings.com

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

这是几乎所有应用程序的连接字符串的好站点

回答by Dimuth De Zoysa

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.

转到服务器资源管理器。并选择已连接的数据库 -> 在其属性中有一个连接字符串 -> 将其复制并粘贴到您的代码中。