DelphiFAQ Home Search:

Determining the record number in a dBASE / Paradox table

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

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;

Comments:

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: