Mega Code Archive

 
Categories / Delphi / Examples
 

Determining the record number in a dbase - paradox table

The following procedure determines the physical number of the current record in a dBase or Paradox table: function FindRecordNumber (aDataSet : TDataSet): longint; var cP: CurProps; rP: RECProps; DBRes: DBiResult; begin {Return 0 if dataset is not Paradox or dBase} Result := 0; with aDataset do begin if state = dsInactive then exit; {we need to make this call to grab the cursor's iSeqNums} DBRes := DBiGetCursorProps(Handle,cP); if DBRes <> DBIERR_NONE then exit; {synchronize the BDE cursor with the dataset's cursor} UpdateCursorPos; {fill rP with the current record's properties} DBRes := DBiGetRecord(Handle,DBiNOLOCK,nil,@rP); if DBRes <> DBIERR_NONE then exit; {what kind of dataset are we looking at?} case cP.iSeqNums of 0: result := rP.iPhyRecNum; {dBase} 1: result := rP.iSeqNum; {Paradox} end; end; end;