如果其他应用正在访问该文件,则无法访问该文件 [英] Can't access DBF file if other app is accessing it

查看:107
本文介绍了如果其他应用正在访问该文件,则无法访问该文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从.NET REST服务中从DBF文件中获取数据.这些文件是另一个应用程序的业务数据.这是一个相当老的应用程序,因此我必须处理dBase/FoxPro.

I am trying to fetch data from DBF files from a .NET REST service. These files are the bussiness data of another application. This is quite an old app, so dBase/FoxPro is what I have to handle.

我只想读取数据.我现在对更新/插入不感兴趣.

I only want to read data. I'm not interested by now in updating/inserting.

我的服务正常运行,我可以使用数据检索JSON消息.当另一个应用程序正在运行时,问题就会出现.如果在其他应用程序运行时尝试访问数据,则会收到错误[HY000] [Microsoft] [ODBC dBase驱动程序]外部表格式不正确的信息.".只要我可以在另一个应用程序未运行时访问数据,错误消息听起来就很奇怪.

My service works OK and I can retrieve JSON messages with the data. The problem emerges when the other app is running. If I try to acces data when the other app is running I get a "ERROR [HY000] [Microsoft][ODBC dBase Driver] External table is not in the expected format.". As long as I can access the data when the other app is not running, the error message sounds weird.

DBF资源管理器之类的其他软件可以在其他应用程序运行的情况下访问数据,因此我认为它在连接字符串或驱动程序上一定配置不正确.

Another software like the DBF explorer can access the data with the other app running, so I think it must be some bad configuration on the connection string or the driver.

有人知道如何配置ODBC连接以便在其他应用程序打开这些表时访问这些表吗?

Does anybody know how to configure de ODBC connection in order to access these tables while they are open by other apps?

提前谢谢!

P.S .:我的连接字符串:

P.S.: My connection string:

@"Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=" + pathtoDBFFile + ";";

推荐答案

首先,我不会使用dBASE驱动程序,而是从MS下载并使用Visual FoxPro OleDb驱动程序.

First, I would not be using the dBASE driver, but instead, download and use the Visual FoxPro OleDb driver from MS.

此外,可以使用ConnectionStrings.com中的以下示例将连接字符串设置为"Exclusive Use"的"Exclusive Use"默认设置为"No".对于OleDb提供程序,驱动程序部分不正确,但是Exclusive = No,deleted = no的上下文以及您可以在其中添加的任何其他设置都可以提供帮助.

In addition, the connection string, you can make the setting for "Exclusive Use" default to No as the following sample from ConnectionStrings.com. The Driver portion is incorrect for the OleDb provider, but the context of Exclusive=No, deleted=no, and whatever other settings you can throw in there can help.

Driver = {Microsoft Visual FoxPro驱动程序}; SourceType = DBC; SourceDB = c:\ myvfpdb.dbc; Exclusive = No; NULL =否;分页=机器; BACKGROUNDFETCH =否;已删除=否;

Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=c:\myvfpdb.dbc;Exclusive=No; NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO;

另一个引用VFP表连接的链接,以及用于下载VFP表的链接VFP OleDB提供程序.

这篇关于如果其他应用正在访问该文件,则无法访问该文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆