如何读取VFP .dbf文件 [英] How to read a VFP .dbf file

查看:1279
本文介绍了如何读取VFP .dbf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在SQL中读取来自VFP服务器的两个.dbf文件,并操作它们。他们坐在服务器上的一个文件夹中。首先,我已经安装了VFPOLEDB驱动程序,ODBC驱动程序及其更新。我已经成功地创建了一个链接服务器到自由表,并在SQL中测试它,它说,连接是好的,那里有东西。我仍然看不到甚至看文件。任何人看到我的代码的任何错误?还是任何提示?已知工作代码的示例代码?我在网上找到了很多例子,但是当我申请修改他们的很多小时,他们仍然不工作。



这里是我的代码:

 选择*从OPENQUERY(LINKEDSVR,select * from employee.dbf)



LINKEDSVR参数信息:



提供程序:ODBC驱动程序的Microsoft OLE DB提供程序

产品名称:Microsoft Visual FoxPro驱动程序

数据源:linkedfoxpro



ODBC linkedfoxpro config:



数据源名称:linkedfoxpro

databasetype:免费表目录

路径:c:\somefolder



驱动程序:Microsoft FoxPro VFP Drver(* .dbf)



谢谢!

解决方案>

这些CDX文件不是由SQL生成的 - 这是VFP创建/使用的索引文件。他们很容易腐败,所以很可能CDX已经损坏,当你有它或在运输。



通过删除CDX文件,您已删除表中的所有索引以及错误的来源。


I have to read two .dbf files that came from a VFP server in SQL and manipulate them. They are sitting in a folder on the server. First, I have installed the VFPOLEDB driver, the ODBC driver, and its update. I have successfully created a linked server to the free tables, and tested it in SQL and it says the connection is fine and there's stuff there. I still can't seem to even look at the files. Anyone see anything wrong with my code? Or any tips? Sample code of known working code? I have found a lot of examples online, but when I apply with the many hours I put into modifying them, they still don't work.

Here is my code:

Select * From OPENQUERY(LINKEDSVR, 'Select * from employee.dbf') 

LINKEDSVR parameter info:

Provider: Microsoft OLE DB Provider for ODBC Drivers
Product Name: Microsoft Visual FoxPro Driver
Data source: linkedfoxpro

ODBC linkedfoxpro config:

Datasource name: linkedfoxpro
databasetype: Free Table Directory
Path: c:\somefolder

Driver: Microsoft FoxPro VFP Drver (*.dbf)

Thanks!

解决方案

Those CDX files are not generated by SQL - that's the index file created/used by VFP. They are very prone to corruption so it is likely that the CDX was already corrupted when you got it or in transit.

By deleting the CDX file, you have removed all indexes from the table and also the source of the error.

这篇关于如何读取VFP .dbf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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