开发者

How to read a VFP .dbf file

开发者 https://www.devze.com 2023-04-11 09:55 出处:网络
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

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 lo开发者_如何学Gook 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消