5

通过不同的 API,我使用相同的参数到达相同的代码

public void Foo(string nprPath, int maxConnections = 3)
{
    var connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + nprPath;

    using (var connectionPool = new ConnectionPool(maxConnections, connectionString))
    {
       ....
    }
}

我使用确切的参数输入 mefhod。一个 API 成功,另一个抛出以下内容

{"The ITransactionLocal interface is not supported by the 'Microsoft.ACE.OLEDB.12.0' 
provider.Local transactions are unavailable with the current provider."}

使用 ACE.OLEDB.12 是否有任何先决条件

4

1 回答 1

8

您可以尝试添加";OLE DB Services=-4"到连接字符串。

像这样的东西:

var connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;OLE DB Services=-4;Data Source=" + nprPath;

另请查看此相关论坛

编辑:-

当 "OLE DB 服务 = -4; 这意味着:-

池化和自动交易登记除外

查看相关的MSDN

于 2013-10-15T17:52:13.467 回答