I am getting close to having a correctly word INSERT INTO sql query but I cannot seem to get the values portion of the statement within quotation marks. The code I have puts quotation marks around the entire contents of the VALUES portion of the statement and not around the individual value terms.
Code: Select all
put "INSERT INTO Mood (" into sqlQuery
put empty into tFieldNames
put revDatabaseColumnNames(conID, "control") into pptext
repeat for each line linColumn in pptext
put tFieldNames & linColumn & "," into tFieldNames
put "'"& tFieldNames &"'" & "," into tFieldValues
end repeat
repeat while the last character of tFieldNames is ","
delete last character of tFieldNames
delete last character of tFieldValues
end repeat
put sqlQuery & tFieldNames & ") VALUES ("into sqlQuery
put tFieldValues & ")" after sqlQuery
answer sqlQuery
The output currently is "INSERT INTO Mood (Handle,Entry,Field01,Field02) VALUES ('Handle,Entry,Field01,Field02,')" but it needs to be "INSERT INTO Mood (Handle,Entry,Field01,Field02) VALUES ('Handle','Entry','Field01','Field02')"
Your help with this is greatly appreciated