Using a database cursor

sschofield sschofield at
Thu Sep 5 09:47:01 EDT 2002


-----Original Message-----
From: Trevor DeVore [mailto:trevor at] 
Sent: 05 September 2002 15:39
To: use-revolution at
Subject: Re: Using a database cursor

On 9/5/02 sschofield at (sschofield) wrote

>I've openend up a database connection and want to map the data. I've 
>set up my cursor but how do I now use it?
>put "SELECT * FROM tblName WHERE tblName.Login = '" & field "login" & 
>"'" into strSql get revdb_query(field "dbID",strSql)
>This seems to be fine, but I can only get it to return things like how 
>many records. How do I get eg the first field of the first record in 
>the cursor? I tried

put revdb_columnbyname(it, "Login")

>put item 1 of line 1 of it into field "MyMessage"
>But it didn't like that. Also, how do I rename the cursor? I tried
>rsLogin = get revdb_query(field "dbID",strSql)

put revdb_query (field "dbID",strSql) into rsLogin

Your cursor will now be called rsLogin.

In addition, if you wanted to put the results returned from the database
into an array as well as check that a record was returned you could do this:

-- Create array
if revdb_iseof(dbCursor) is false then
    put revdb_columnbyname(dbCursor, "YourDbField1") into
    put revdb_columnbyname(dbCursor, "YourDbField2") into
    put revdb_columnbyname(dbCursor, "YourDbField3") into
dbArray["YourDbField3"] else
    put "No record found"
end if

Hope this helps,

Trevor DeVore
Blue Mango Multimedia
trevor at _______________________________________________
use-revolution mailing list
use-revolution at

More information about the Use-livecode mailing list