"could not found languang driver"
将table.TableType:=ttFoxpro即可
"corrupt table/index header"是表头或索引坏了
先删除表的索引文件,再打开重建索引。
//删除索引文件
Function DeleteIndex(filename:string;tablename:TTable):boolean;
const
_NoIndex: byte = 0;
var
fBeFixed: file of byte;
begin
try
if tablename.DatabaseName='' then
filename:=Trim(filename)
else
filename:=Trim(tablename.DatabaseName+'/'+filename);
tablename.Close;
AssignFile(fBeFixed,filename+'.dbf');
FileMode := 2;
Reset(fBeFixed);
Seek(fBeFixed, 28);
Write(fBeFixed, _NoIndex);
CloseFile(fBeFixed);
if FileExists(filename+'.mdx') then
DeleteFile(filename+'.mdx');
if FileExists(filename+'.cdx') then
DeleteFile(filename+'.cdx');
Result:=True;
except
Result:=False;
end;
end;
//重建索引
Function MakeIndex(filename,indexname:string;tablename:TTable):boolean;
begin
try
if DeleteIndex(filename,tablename) then
begin
tablename.AddIndex(indexname,indexname,[]);
tablename.Open;
Result:=True;
end
else
Result:=False;
except
Result:=False;
end;
end;