Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Relational Databases
Expertise: Beginner
Jul 14, 1999

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 MyTable
WHERE 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.
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap