Page 1 of 1
Returning a value from an SQL query
Posted: Thu Jan 31, 2019 3:07 pm
by Mikofig
I am using MAMP in order to connect to an SQL database. I can connect just fine but the problem arises when I try to execute my query. I am trying to perform a count(*) query on a table and return the value but every time I run it the result is "OK" which apparently counts as a number because it causes my "if the result is a number" statement to trigger. any ideas as to how I could fix this?
Re: Returning a value from an SQL query
Posted: Thu Jan 31, 2019 3:33 pm
by ghettocottage
can we see the code you have so far? or the query and return section of it?
Re: Returning a value from an SQL query
Posted: Thu Jan 31, 2019 3:37 pm
by Mikofig
put "SELECT COUNT(*) FROM scores" into tSQL
revExecuteSQL gConnectionID, tSQL
if the result is a number then
put it into temp
put "00000" + temp into ScoreID
else
answer"nope"
end if
answer ScoreID
Re: Returning a value from an SQL query
Posted: Thu Jan 31, 2019 4:55 pm
by matthiasr
You have to use the function revDatafromQuery for this.
revExecuteSQL is used for example for inserting, updating, deleting a record.
Re: Returning a value from an SQL query
Posted: Thu Feb 07, 2019 3:41 pm
by Mikofig
Thank you very much, everything works fine now
Re: Returning a value from an SQL query
Posted: Thu Feb 07, 2019 3:50 pm
by Klaus
A look into the Dictionary, which is better than its reputaiton, usually clears these kind of "misunderstandings"!
