Using a database cursor
Trevor DeVore
trevor at mangomultimedia.com
Thu Sep 5 11:21:00 EDT 2002
In the code below the phrase Welcome <Name> will appear every time because you have it appearing outside the if statement. If you are getting the Welcome message along with the "Sorry, no login for <Name>" message it means that revdb_recordcount is working. Just delete the line right after get revdb_query and then only the message that you expect will show up.
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com
On 9/5/02 sschofield at computing.dundee.ac.uk (sschofield) wrote
>Thanks again. I now have the results coming out of my database, yippee. You
>mention the documentation which I have indeed consulted, but I find the
>examples rather bald. They're never embedded in code. Eg. I'm now trying to
>find the recordcount so I can reject the login if recordcount < 0. but it
>doesn't seem to work. The example code is a bald
>revdb_recordcount(westCoastCustomers).
>
> put "SELECT * FROM tblName WHERE tblName.Login = '" & field "login" & "'"
>into strSql
> get revdb_query(field "dbID",strSql)
> put "Welcome " & revdb_columnbyname(it,"fname") into field "MyMessage"
>
> if revdb_recordcount(it) <= 0 then
> put "Sorry, no login for " & field "login" & " in the database"
> else
> put "Welcome " & revdb_columnbyname(it,"fname") into field "MyMessage"
> end if
>
>Both welcomes Sian (so obviously found a record) and gives message Sorry no
>login cos it claims recordcount(it) is -1.
More information about the use-livecode
mailing list