Registriert seit: 1. Apr 2004
1 Beiträge
|
Re: Aktuelle Cursorposition im RecordSet-Objekt auslesen?
1. Apr 2004, 12:22
Delphi-Quellcode:
procedure PackTable(Table: TTable);
var
FCurProp: CurProps;
TblDesc: CRTblDesc;
hDb: hDbiDB;
TablePath: array[0..dbiMaxPathLen] of Char;
Exclusive: Boolean;
begin
if not Table.Active then
_DBError(SDataSetClosed);
Check(DbiGetCursorProps(Table.Handle, FCurProp));
if StrComp(FCurProp.szTableType, szParadox) = 0 then begin
hDb := nil;
FillChar(TblDesc, SizeOf(CRTblDesc), 0);
with TblDesc do begin
StrPCopy(szTblName, Table.TableName);
StrCopy(szTblType, FCurProp.szTableType);
bPack := True;
end;
Check(DbiGetDirectory(Table.DBHandle, False, TablePath));
Table.Close;
try
Check(DbiOpenDatabase(nil, szCFGDBSTANDARD, dbiReadWrite,
dbiOpenExcl, nil, 0, nil, nil, hDb));
Check(DbiSetDirectory(hDb, TablePath));
Check(DbiDoRestructure(hDb, 1, @TblDesc, nil, nil, nil, False));
Check(DbiCloseDatabase(hDb));
finally
Table.Open;
end;
end
else
if StrComp(FCurProp.szTableType, szDBase) = 0 then begin
Exclusive := Table.Exclusive;
Table.Close;
try
Table.Exclusive := True;
Table.Open;
try
Check(DbiPackTable(Table.DBHandle, Table.Handle, nil,
nil,True));
finally
Table.Close;
end;
finally
Table.Exclusive := Exclusive;
Table.Open;
end;
end
else
DbiError(DBIERR_WRONGDRVTYPE);
end;
[edit=Sharky]Delphi-Tags gesetzt! Mfg, Sharky[/edit]
|
|
Zitat
|