Excel oledb连接到Ms-Access数据库锁访问数据库

时间:2021-09-14 07:32:56

I have an excel spreadsheet that connects to MS-Access 2003 database using ole db connection. When I refresh the data in spreadsheet and open my ms-access database it says database is read-only. If I close the spreadsheet and then open MS-Access DB then it opens in Write mode. The following is the connection string used in Excel spreadsheet.

我有一个excel电子表格,使用ole db连接连接到MS-Access 2003数据库。当我刷新电子表格中的数据并打开我的ms-access数据库时,它说数据库是只读的。如果我关闭电子表格然后打开MS-Access DB,它将以写入模式打开。以下是Excel电子表格中使用的连接字符串。

Provider=Microsoft.Jet.OLEDB.4.0;Password="";User ID=Admin;
Data Source=D:\Dev\Reports.mdb;Mode=Share Deny Write;Extended Properties="";
Jet OLEDB:System database="";Jet OLEDB:Registry Path="";
Jet OLEDB:Database Password="";
Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=0;
Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;
Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;
Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;
Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False

3 个解决方案

#1


19  

Change "Mode=Share Deny Write" to "Mode=Read"

将“Mode = Share Deny Write”更改为“Mode = Read”

in connection string

在连接字符串中

#2


1  

Have you checked that the Excel user has full permissions on the folder containing the Access file?

您是否检查过Excel用户对包含Access文件的文件夹的完全权限?

#3


1  

Excel's background refresh option is enabled. Disable it, or use the query studio to design the query as DBQ.

Excel的后台刷新选项已启用。禁用它,或使用查询工作室将查询设计为DBQ。

<xml id=msodc><odc:OfficeDataConnection xmlns:odc="urn:schemas-microsoft-com:office:odc"
xmlns="http://www.w3.org/TR/REC-html40">
  <odc:Connection odc:Type="ODBC">
    <odc:ConnectionString>
    DBQ=<database path and filename>;DefaultDir=<database path>;
    Driver={Microsoft Access Driver (*.mdb, *.accdb)};DriverId=25;
    FIL=MS Access;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;
    ReadOnly=1;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;
    </odc:ConnectionString>
  <odc:CommandText>SELECT ... FROM ... WHERE ... </odc:CommandText>
  </odc:Connection>
</odc:OfficeDataConnection></xml>

#1


19  

Change "Mode=Share Deny Write" to "Mode=Read"

将“Mode = Share Deny Write”更改为“Mode = Read”

in connection string

在连接字符串中

#2


1  

Have you checked that the Excel user has full permissions on the folder containing the Access file?

您是否检查过Excel用户对包含Access文件的文件夹的完全权限?

#3


1  

Excel's background refresh option is enabled. Disable it, or use the query studio to design the query as DBQ.

Excel的后台刷新选项已启用。禁用它,或使用查询工作室将查询设计为DBQ。

<xml id=msodc><odc:OfficeDataConnection xmlns:odc="urn:schemas-microsoft-com:office:odc"
xmlns="http://www.w3.org/TR/REC-html40">
  <odc:Connection odc:Type="ODBC">
    <odc:ConnectionString>
    DBQ=<database path and filename>;DefaultDir=<database path>;
    Driver={Microsoft Access Driver (*.mdb, *.accdb)};DriverId=25;
    FIL=MS Access;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;
    ReadOnly=1;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;
    </odc:ConnectionString>
  <odc:CommandText>SELECT ... FROM ... WHERE ... </odc:CommandText>
  </odc:Connection>
</odc:OfficeDataConnection></xml>