Board index » delphi » Table1.RecNo returns -1

Table1.RecNo returns -1

Hello all,
Any suggestions why  Table1.RecNo always returns a -1 regardless of which
record the cursor has selected? The online docs state that it should return
the currently selected record number.

Regards,
Bill Richards
bill_richa...@nic.edu

 

Re:Table1.RecNo returns -1


You don't specify which database and version of Delphi you are using, so
these are only generalizations.

Delphi only supports record numbers in Paradox and dBase tables, not SQL
servers. So using recno on an SQL database will return -1. I don't know if
this applies to you or not.

Also if you happen to use TDataset.recno  it always returns -1.

Wes

Re:Table1.RecNo returns -1


Thanks for your comments

Quote
Wes Hill wrote in message <7ceejn$qm...@forums.borland.com>...
>You don't specify which database and version of Delphi you are using, so
>these are only generalizations.

>Delphi only supports record numbers in Paradox and dBase tables, not SQL
>servers. So using recno on an SQL database will return -1. I don't know if
>this applies to you or not.

>Also if you happen to use TDataset.recno  it always returns -1.

>Wes

However, I am using Delphi4 and MSACCESS local tables via the BDE.
therefore, I would assume the behavior if RecNO should be the similar to
Pdox and dBase. I am using RecNo at the table level not the dataset level
(aren't I) when I use Table1.RecNo ?
What next?
Bill

Re:Table1.RecNo returns -1


What database are you using? It works with Paradox and dBase tables?

Bill

--

Bill Todd - TeamB
(TeamB cannot respond to email questions. To contact me
 for any other reason remove nospam from my address.)

Re:Table1.RecNo returns -1


However, I am using Delphi4 and MSACCESS local tables via the BDE.
therefore, I would assume the behavior of RecNO should be similar to
Pdox and dBase. I am using RecNo at the table level not the dataset level
(aren't I) when I use Table1.RecNo ?
What next?
Bill

Re:Table1.RecNo returns -1


|However, I am using Delphi4 and MSACCESS local tables via the BDE.
|therefore, I would assume the behavior of RecNO should be similar to
|Pdox and dBase. I am using RecNo at the table level not the dataset level
|(aren't I) when I use Table1.RecNo ?
|What next?

RecNo really works only against dBase files. Because only dBase has a record
number that means something : this is the physical record number. dBase uses
a very old architecture (I remember my Dbase II on my Kaypro under CP/M in
1981 !).
Paradox doesn't have any record number. It can just simulates pseudo recno
that are valid only within the current selection (filter).
When you change the filter, recno's are different.

That's for local databases.
"true" databases (SQL ones) have definitely no recno, even simulated... So
forget this trace of a dead age !

Re:Table1.RecNo returns -1


Access does not support record numbers. Neither to most database servers.

Bill

--

Bill Todd - TeamB
(TeamB cannot respond to email questions. To contact me
 for any other reason remove nospam from my address.)

Re:Table1.RecNo returns -1


Woh !
Bill, might have said that Borland's BDE driver does not support record
number...
I have been using VB since the release 3, and a RecordSet object (Dynaset,
Snapshot or Table) does have recordcount property. Sometime you have to go
to the last record to get the real record count, instead it may return -1.

Alex

Bill Todd a crit dans le message <7ch513$...@forums.borland.com>...

Quote
>Access does not support record numbers. Neither to most database servers.

>Bill

>--

>Bill Todd - TeamB
>(TeamB cannot respond to email questions. To contact me
> for any other reason remove nospam from my address.)

Other Threads