Page 1 of 1

issue with code on db query?

Posted: Mon Apr 13, 2015 1:58 pm
by sms5138
Hi everyone,

I'm trying to query a database filtering for a specific name. I keep receiving the following error message, but am unsure as to how to correct it:

button "check it out!": compilation error at line 9 (Commands: missing ',') near "into", char 55

Any advice would be greatly appreciated. I've included the code below:

Code: Select all

on mouseUp
   global gConnectionID
    if gConnectionID is not a number then
        answer error "Please connect to the database first."
        exit to top
    end if
    
    put "status" into tTableName
    put "select * from status where name='& field "who"'" into tSQL
    
    -- query the database
    put revDataFromQuery(tab, cr, gConnectionID, tSQL) into tData
    
    if item 1 of tData = "revdberr" then
        answer error "There was a problem querying the database:" & cr & tData
    else
       put tData into field "Data"
       answer "congrats"
    end if
end mouseUp
Thanks in advance for any help!

-Sean

Re: issue with code on db query?

Posted: Mon Apr 13, 2015 2:05 pm
by LCNeil
Hi Sean,

Try replacing line 9 with

Code: Select all

 put "select * from status where name='"& field"who"&"'"
Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
--

Re: issue with code on db query?

Posted: Mon Apr 13, 2015 2:28 pm
by sms5138
Hey Neil,

Thank you for the quick response! That fixed my issue!

Regards,

Sean

Re: issue with code on db query?

Posted: Mon Apr 13, 2015 2:38 pm
by LCNeil
Hi Sean,

Great to hear I was able to help out :)

Good luck with the rest of your db app

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
--