简体   繁体   English

MS Access运行时和连接参数

[英]MS Access Runtime and Connection Parameters

I am having a problem figuring out MS Access connections string. 我在弄清楚MS Access连接字符串时遇到问题。 As per this question , I set up my connection definitions to: 根据这个问题 ,我将连接定义设置为:

<add key="CONNECTION_PROVIDER" value="Microsoft.ACE.OLEDB.12.0" />
<add key="CONNECTION_STRING" value="Data Source = C:\Users\me\Documents\FareReconciliation.accdb;Persist Security Info=False;" />

Petapoco returns Server not found error. Petapoco返回Server not found错误。 I have Office 2016 Pro Installed. 我已安装Office 2016 Pro。 I tried to download the the Access Runtime but it says one one product may be installed once. 我尝试下载Access Runtime,但是它说一个产品可能只安装一次。 I can open the FareReconciliation.accdb file in Access. 我可以在Access中打开FareReconciliation.accdb文件。 This is an old file. 这是一个旧文件。 what should be my CONNECTION_PROVIDER ? 我的CONNECTION_PROVIDER应该是什么? Is it based on what version of Access I have or which Access Version that the Database originally created? 是基于我拥有的Access版本还是数据库最初创建的Access版本?

Remember, this is an old Access Db. 记住,这是旧的Access Db。 How do I find the actual Runtime Version or whatever (if necessary)? 如何找到实际的运行时版本或其他内容(如有必要)?

Assuming you are connecting to Access using .NET... 假设您正在使用.NET连接到Access ...

Define your connection string in the *.config file follows: 在* .config文件中定义您的连接字符串,如下所示:

<connectionStrings>
    <add name="CONNECTION_STRING" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;;Data Source=C:\Users\me\Documents\FareReconciliation.accdb;Persist Security Info=False;" />
</connectionStrings>

In code (VB in this example) reference the connection string as follows: 在代码(此示例中为VB)中,按如下所示引用连接字符串:

Var connString As String = Configuration.ConfigurationManager.ConnectionStrings("CONNECTION_STRING").ConnectionString

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM