more SQL problems

Frank D. Engel, Jr. fde101 at fjrhome.net
Wed Dec 29 12:01:11 EST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

revDataFromQuery does not use the revDatabaseColumnNamed function -- 
that works quite differently.  You want the revQueryDatabase function 
instead.

Try this:


on mouseUp
   put revQueryDatabase(dbID, field "CurrSQL" & field "mySearch") into q

   if q is not a number then
     answer error "Database Error: " & q
     exit mouseUp
   end if

   revMoveToFirstRecord q
   put revDatabaseColumnNamed(q, "City") into field "myCity"
   put revDatabaseColumnNamed(q, "State") into field "myState"
   put revDatabaseColumnNamed(q, "Zip") into field "myZip"

   revCloseCursor q
end mouseUp



On Dec 29, 2004, at 11:09 AM, docmann wrote:

> Hello folks,
> I've been trying to resolve a problem on my own off and on for several
> days and just can't seem to get my head wrapped around it all. Even
> worse, now with so many attempts and errors under my belt, I have
> finally reached the point of almost total confusion. :(
>
> Let's say that I have a MySQL database named "quickref"
> The 3 records in my table look something like this:
> --------------------------
> |  City  |  State | Zip  | --*City is the primary key
>
>   Houston   Texas   74239
>
>   Portland  Oregon  32791
>
>   Dallas    Texas   75217
> --------------------------
>
> dbID is the ID returned when the connection is established
>
> revField1 is named "myCity" --used to display record content
> revField2 is named "myState" --used to display record content
> revField3 is named "myZip" --used to display record content
>
> revField4 is named "CurrSQL" and contains "SELECT * FROM quickref 
> WHERE City ="
> revField5 is named "mySearch" and contains "Portland"
>
> I have no problems connecting to the database and returning the dbID
> and all I want to do is display the contents of a record in each of
> three fields based on the name of the city entered into the "mySearch"
> field.
>
> RevButton Named "Search"
> on mouseUp
>   put field "CurrSQL" into tSQLStringPartOne
>   put field "mySearch" into tSQLStringPartTwo
>   put tSQLStringPartOne & " " & tSQLStringPartTwo into tSQLQuery
>
>   get revDataFromQuery(,,dbID,tSQLQuery,"tMyResults")
>
> end mouseUp
>
>
> I've tried using an almost endless number of
> "revDatabaseColumnNamed()" combinations trying to extract the data,
> without luck.  Although there may still be more than one problem in my
> scripting, I *think* that the issue is in the way I'm trying to use
> the revDatabaseColumnNamed() function which I don't fully understand.
>
> Based on the info shown, can someone please show me how to properly
> get the record set into variables so I can display them in the
> appropriate fields on my stack?
>
> I'd really appreciate any help or advise.
>
> -Doc-
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
- -----------------------------------------------------------
Frank D. Engel, Jr.  <fde101 at fjrhome.net>

$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten 
Son, that whosoever believeth in him should not perish, but have 
everlasting life.
$
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFB0uLY7aqtWrR9cZoRAthgAJ4hamACeIisOOhks6XnsBfGModGWwCeOTbK
rjPwIeDkPGunNEJwWGIfoBk=
=WgRs
-----END PGP SIGNATURE-----



___________________________________________________________
$0 Web Hosting with up to 120MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com



More information about the use-livecode mailing list