Page 1 of 1

Using PreviousDatabaseRow()

Posted: Wed Jul 23, 2003 6:49 pm
by TerryHough
Still learning how to use the database features of PB.

Every effort to use PreviousDatabaseRow() returns a value of 0 rather
than positioning back to the previous row.

Code snip..

Code: Select all

    Case #NextButton
      Num = NextDatabaseRow()  
      If Num
        NextRecord()  ; procedure to handle the record
      Else
        DisableGadget(#NextButton,1)
      EndIf     
    Case #PrevButton
      Num = PreviousDatabaseRow()
      If Num
        PrevRecord() ; procedure to handle the record
      Else
        DisableGadget(#PrevButton,1)
      EndIf     
While NextDatabaseRow() works perfectly, the PreviousDatabaseRow()
always returns a value of 0 even though there should be numerous
previous rows to back up through.

Has anybody experienced this? Any suggestions?

Thanks,
Terry

Posted: Wed Jul 23, 2003 7:02 pm
by GedB
I think this may be to do with the ODBC driver.

Backwards scrolling is not supported by all ODBC drivers.
When Scrolling Is Supported
As originally designed, SQL provided only forward scrolling, but ODBC extends scrolling capabilities. The available level of support for scrolling depends on the ODBC driver(s) your application will work with, your driver's ODBC API conformance level, and whether the ODBC Cursor Library is loaded into memory.

http://msdn.microsoft.com/library/defau ... DBC.29.asp
I've tried to find if there is a way to find out what is supported by which drivers, but I've had no luck.

Posted: Wed Jul 23, 2003 7:17 pm
by TerryHough
Thanks for the quick reply GedB.

Drat... this is frustrating... apparently just what Microsoft intended!

Appreciate the information.

Terry

Posted: Thu Jul 24, 2003 9:47 am
by GedB
Terry,

You might find updating to the latest ODBC drivers will help.

Problem with this is you can't be sure how things will work out on a clients machine.

Your probably best of copying the results into memory if you need to move backwards and forwards.