Displaying a Record Number for a Table

Displaying a Record Number for a Table

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?

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.

See also  How College Students Can Shape the Future of Tech Responsibility

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist