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;
|