这听起来像是在标头中有一个自动打开 (.MDX) 索引标志,但该索引在数据库中不存在。
你可以试试这个——它会清除数据库标题中的自动打开标志。使用数据库的副本进行测试!!!我没有在 DBase IV 上进行过测试,但它适用于 FoxPro 和 DBase 的多种版本。
procedure FixDBFHeader(const FileName: string);
var
ByteRead: Byte;
Stream: TFileStream;
begin
Stream := TFileStream.Create(FileName, fmOpenReadWrite or fmShareDenyNone);
try
// Byte offset 28 has a value of 0x01 if a structural (auto-open) index exists,
// or 0x00 if no such index exists. If the value is not set, we do nothing.
Stream.Position := 28;
Stream.Read(ByteRead, SizeOf(ByteRead));
if ByteRead = 1 then
begin
ByteRead := 0;
Stream.Position := 28;
Stream.Write(ByteRead, SizeOf(Byte));
end;
finally
Stream.Free;
end;
end;
After clearing that flag in the header, you should be able to open the .DBF with ADO or Advantage Database Server - their local server is free, and supports SQL. Note that I'm not affiliated with Advantage in any way; I've just used their product to work with legacy DBF files for a long time.