FirstDatabaseRow()

Just starting out? Need help? Post your questions and find answers here.
TheFlyingDutchman
New User
New User
Posts: 8
Joined: Sun Jan 28, 2007 2:18 pm
Location: USA

FirstDatabaseRow()

Post by TheFlyingDutchman »

I am accessing an Access mdb file using the Database functions.

Calling NextDatabaseRow() after DatabaseQuery() works.

Calling FirstDatabaseRow() after DatabaseQuery() does not work, as FirstDatabaseRow() always returns 0 (no rows available) even though there are rows in the Query ("database").
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

I've seen this before, although I haven't done enough database work with PB and ODBC to know the exact reason why.

Most examples I've seen stick to NextDatabaseRow() and seem to avoid FirstDatabaseRow(), so in a way, you've answered your own question! :)

Perhaps FirstDatabaseRow() is to be used before a query is submitted, i.e. between opening the database and submitting an SQL query etc.
I may look like a mule, but I'm not a complete ass.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

FirstDatabaseRow() seems to work fine here for me. :?
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
wayne-c
Enthusiast
Enthusiast
Posts: 337
Joined: Tue Jun 08, 2004 10:29 am
Location: Zurich, Switzerland

Post by wayne-c »

I also encountered problems with FirstDatabaseRow() in a project when I wanted to first loop through all records to count them and then restart the loop.

I am not sure, but probably it has something to do with the type of query (table-only or join)? I remember that with VB and ADO you could also select a forward-only database cursor...
As you walk on by, Will you call my name? Or will you walk away?
Post Reply