Board index » delphi » Obtaining the Current Record No in MS SQL 6.5 with Delphi 3

Obtaining the Current Record No in MS SQL 6.5 with Delphi 3

Hi,

I'm trying to obtain the current record number of a query using the RECNO
statement.  However, it shows the record number as -1.

thanking you in advance !

 

Re:Obtaining the Current Record No in MS SQL 6.5 with Delphi 3


Quote
Jess Shoker wrote:

> Hi,

> I'm trying to obtain the current record number of a query using the
> RECNO
> statement.  However, it shows the record number as -1.

> thanking you in advance !

Sorry, RECNO only works with dBase and Paradox tables.  If you want to
know approximately where you are within a recordset you need to get the
RecordCount and keep a running counter that is incremented/decremented
as you move through the record set.  HTH - Mike
--
==========================================================
=  Beauty = class(Thing)
=
=  ie: A Thing of Beauty is (still) a Thing...
==========================================================

Re:Obtaining the Current Record No in MS SQL 6.5 with Delphi 3


Quote
Michael Mount wrote:

> Jess Shoker wrote:

> > Hi,

> > I'm trying to obtain the current record number of a query using the
> > RECNO
> > statement.  However, it shows the record number as -1.

> > thanking you in advance !

> Sorry, RECNO only works with dBase and Paradox tables.  If you want to
> know approximately where you are within a recordset you need to get the
> RecordCount and keep a running counter that is incremented/decremented
> as you move through the record set.  HTH - Mike
> --

Do you have an example of this you could post?

Rkr

--
                   \|||/
                   /'^'\
                  ( 0 0 )
--------------oOOO--(_)--OOOo--------------
. Reid Roman                              .
. Delphi Programmer / Analyst             .
. TVisualBasic:=class(None);              .
. May the Source be With You              .
-------------------------------------------
. Auto-By-Tel (http://www.autobytel.com)  .
. Irvine, CA U.S.A                        .
. E-Mail : rkroman (at) pacbell (dot) net .
. or reidr (at) autobytel (dot) com       .
-------------------------------------------

Re:Obtaining the Current Record No in MS SQL 6.5 with Delphi 3


Reid,

I don't have any handy (I don't do it often) but as you can imagine this
method is of limited value.  You have to know that the user is ONLY
going to be able to navigate the recordset with your provided navigation
methods.  ie: Form View and First (CurRec = 1), Prior (CurRec - 1), Next
(CurRec + 1), and Last (MaxRec) buttons (the old
DOS-You-GET-WHAT-I-GIVE-You approach).  If you give them a grid there's
no way (I've found yet) of knowing how much to increment/decrement your
counter.  Likewise if you give the user the means to Locate a record,
unless you manually search, you don't know at what position you're going
to end up at.  The same is true of BookMarks and changing the sort order
(assuming you bookmark and return to current record).

I've heard that some SQL Servers have a RECNO variable that gets
generated when you get a result set and you can query it for it's
value.  I don't know if this is true of MSSQL.

If you'd still like a code sample, I can certainly dig one out of the
archives somewhere given a day or so to find it...  Let me know.

- Mike

Re:Obtaining the Current Record No in MS SQL 6.5 with Delphi 3


Quote
Michael Mount wrote:

> Reid,

> I don't have any handy (I don't do it often) but as you can imagine this
> method is of limited value.  You have to know that the user is ONLY
> going to be able to navigate the recordset with your provided navigation
> methods.  ie: Form View and First (CurRec = 1), Prior (CurRec - 1), Next
> (CurRec + 1), and Last (MaxRec) buttons (the old
> DOS-You-GET-WHAT-I-GIVE-You approach).  If you give them a grid there's
> no way (I've found yet) of knowing how much to increment/decrement your
> counter.  Likewise if you give the user the means to Locate a record,
> unless you manually search, you don't know at what position you're going
> to end up at.  The same is true of BookMarks and changing the sort order
> (assuming you bookmark and return to current record).

> I've heard that some SQL Servers have a RECNO variable that gets
> generated when you get a result set and you can query it for it's
> value.  I don't know if this is true of MSSQL.

> If you'd still like a code sample, I can certainly dig one out of the
> archives somewhere given a day or so to find it...  Let me know.

> - Mike

I see what you mean...

I would just like to be able to show the progress in MSSQL..

If a label on a form could be constantly updated with the current CURSOR
position to indicate progress that would be a start...

Thanks for the reply..

Rkr

--
                   \|||/
                   /'^'\
                  ( 0 0 )
--------------oOOO--(_)--OOOo--------------
. Reid Roman                              .
. Delphi Programmer / Analyst             .
. TVisualBasic:=class(None);              .
. May the Source be With You              .
-------------------------------------------
. Auto-By-Tel (http://www.autobytel.com)  .
. Irvine, CA U.S.A                        .
. E-Mail : rkroman (at) pacbell (dot) net .
. or reidr (at) autobytel (dot) com       .
-------------------------------------------

Other Threads