怎样完全删除(pack)数据库中已删除的记录? (20分)

L

ldelphi

Unregistered / Unconfirmed
GUEST, unregistred user!
怎样完全删除(pack)数据库中已删除的记录?我想要这方面的软件!
 
table1.empty
 
用foxpro 做个Dll,或自己读写DBF,但后面有索引时比较麻烦。
 
在delete之后用dbipacktable
tabds.Delete ;
packrec:=dbipacktable(tabds.DBHandle,tabds.Handle,NIL,NIL,true);
 
procedure TForm1.Button1Click(Sender: TObject);
var
Error: DbiResult;
ErrorMsg: String;
Special: DBIMSG;
begin
table1.Active := False;
try
Table1.Exclusive := True;
Table1.Active := True;
Error := DbiPackTable(Table1.DBHandle, Table1.Handle, nil, szdBASE, True);
Table1.Active := False;
Table1.Exclusive := False;
finally
Table1.Active := True;
end;
case Error of
DBIERR_NONE:
ErrorMsg := 'Successful';
DBIERR_INVALIDPARAM:
ErrorMsg := 'The specified table name or the pointer to the table ' +
'name is NULL';
DBIERR_INVALIDHNDL:
ErrorMsg := 'The specified database handle or cursor handle is ' +
'invalid or NULL';
DBIERR_NOSUCHTABLE:
ErrorMsg := 'Table name does not exist';
DBIERR_UNKNOWNTBLTYPE:
ErrorMsg := 'Table type is unknown';
DBIERR_NEEDEXCLACCESS:
ErrorMsg := 'The table is not open in exclusive mode';
else
DbiGetErrorString(Error, Special);
ErrorMsg := '[' + IntToStr(Error) + ']: ' + Special;
end;
MessageDlg(ErrorMsg, mtWarning, [mbOk], 0);
end;
 
多人接受答案了。
 
顶部