Displaying a Record Number for a Table

Question:
I use an InterBase database with an alias made in BDE. I want to display the record number for a table when I navigate through the records.

Your solution <>.RecNo always returns –1 because it is a TDataSet.RecNo.

Is there another solution?

Answer:
There is no such thing as a record number with server-based databases such as InterBase and others like SQL Server and Oracle. This is because these database servers are set-based, not record-based. RecNo only applies to desktop databases like Paradox and dBASE (and clones).

You might be able to “fake” the record number with your table if you have a unique identifier in that table, and that unique identifier is a single column. In that case, you’d do something like this:

 SELECT Count(UniqueIDColumn)FROM MyTableWHERE UniqueIDColumn <= IDValue

where IDValue is the ID value of the current "record." Of course, you'd have to know that with some sort of retrieval SQL statement.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: