Page 2 of 2
Re: Retrieve one record, contents into text fields
Posted: Sat Oct 11, 2014 1:35 am
by neatgadgets
Yes, as I said, the only difference in the code was the delimiter in the line
Code: Select all
put revdatafromquery(,,sDbId,tSql) into tData
was set in my code.
There are no commas in my data. I put a simple test set of data. Has anyone actually used MySQL with LiveCode? And what version of MySQL has LiveCode been tested against?
Re: Retrieve one record, contents into text fields
Posted: Sat Oct 11, 2014 1:46 am
by sturgis
EDIT: reread the first one where you put this.
Code: Select all
-- construct the SQL (this selects all the data from the specified table)
put "properties" into tTableName -- set this to the name of a table in your database
put "SELECT * FROM " & tTableName into tSQL
-- query the database
put revDataFromQuery(tab, cr, gConnectionID, tSQL) into tData
put item 2 of tData into fld "fldStreetNumber"
put item 3 of tData into fld "fldStreetName"
And you said you tried it modified like this:
Code: Select all
-- construct the SQL (this selects all the data from the specified table)
put "properties" into tTableName -- set this to the name of a table in your database
put "SELECT * FROM " & tTableName into tSQL
-- query the database
put revDataFromQuery(tab, cr, gConnectionID, tSQL) into tData
-- Added lines
set the itemdelimiter to tab -- so that lc knows how to break up items
put tData -- (so that you can see all your data in the message box to get visual feedback of what is actually being returned)
-- End Added Lines
put item 2 of tData into fld "fldStreetNumber"
put item 3 of tData into fld "fldStreetName"
And yeah, lots of people use mysql with livecode. As far back as I can remember in fact. Not sure when mysql support first appeared but its been in there a long time. However, lots of changes are going on right now, so its possible something has snuck in. What version of lc are you using? I'll grab the same and see if I can duplicate the problem.
Re: Retrieve one record, contents into text fields
Posted: Sat Oct 11, 2014 4:36 am
by neatgadgets
Code: Select all
put "properties" into tTableName -- set this to the name of a table in your database
put "SELECT * FROM " & tTableName into tSQL
-- query the database
put revDataFromQuery(tab, cr, gConnectionID, tSQL) into tData
set itemdel to TAB
put tData
put item 2 of tData into fld "fldStreetNumber"
put item 3 of tData into fld "fldStreetName"
I note you had
I tried that also, same result.
Re: Retrieve one record, contents into text fields
Posted: Mon Oct 13, 2014 3:25 pm
by Klaus
Hi neatgadgets,
the syntax is definitively correct! So maybe there is something wrong your data or database or whatever!
I could offer to take a look at your stack.
If that is OK, then:
1. create a new field somewhere in your stack and put the result of ONE query into this field, so no need to access your database!
2. Then you can delete all the database access stuff, like passowrd and log-in data.
3. Send me that "stripped-down" stack -> klaus AT major-k.de
Best
Klaus