issue with code on db query?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
sms5138
Posts: 126
Joined: Mon Feb 23, 2015 11:49 pm

issue with code on db query?

Post by sms5138 » Mon Apr 13, 2015 1:58 pm

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

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: issue with code on db query?

Post by LCNeil » Mon Apr 13, 2015 2:05 pm

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
--

sms5138
Posts: 126
Joined: Mon Feb 23, 2015 11:49 pm

Re: issue with code on db query?

Post by sms5138 » Mon Apr 13, 2015 2:28 pm

Hey Neil,

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

Regards,

Sean

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: issue with code on db query?

Post by LCNeil » Mon Apr 13, 2015 2:38 pm

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
--

Post Reply