Page 1 of 1

Unknown column in field list

Posted: Thu Jul 06, 2017 1:32 am
by Quinton B.
Hello, I'm currently running MySQL and when using an insert statement the following error displays "Unknown column " " in 'Filed List'" I have no idear what it is squeaking about. I have the column in the database and this is the insert statement:

put "INSERT INTO precheckopen (LogInLocation, LogInCounter, DeviceName, DateAndTime) VALUES (" & tEndLocation &","& tRecordsFinal &","& tDeviceName &"," & tDateAndTime &");" into tSQL
revExecuteSQL gDatabaseID, tSQL
answer the result

Please Help, its really quite annoying :lol: .

Re: Unknown column in field list

Posted: Fri Jul 07, 2017 1:27 pm
by MaxV
Quote the columns names with the apostrophe character ' .

Re: Unknown column in field list

Posted: Sat Jul 08, 2017 11:27 pm
by Quinton B.
That only inputs the names tEndLocation, tRecordsFinal, etc.. Doesn't input the data as these are variables.

Re: Unknown column in field list

Posted: Sun Jul 09, 2017 9:35 am
by SparkOut
He meant quote the column names 'LogInLocation' etc.

Where does the "Filed List" come from? Is there a typo somewhere in some other code and it should be "Field List"?

Better in the end to try the " placeholder " syntax and see if that sorts out any escaping glitches or other. The error message doesn't give enough information to tell without seeing more of your code and table structure.

Code: Select all

put "INSERT INTO precheckopen ('LogInLocation','LogInCounter', 'DeviceName', 'DateAndTime') VALUES (:1,:2,:3,:4)" into tSQL
revExecuteSQL gDatabaseID, tSQL,"tEndLocation","tRecordsFinal","tDeviceName","tDateAndTime"

Re: Unknown column in field list

Posted: Tue Jul 11, 2017 10:51 pm
by Quinton B.
This still isn't working:

put "INSERT INTO precheckopen ('LogInLocation','LogInCounter','DeviceName','DateAndTime') VALUES (:1,:2,:3,:4)" into tSQL
revExecuteSQL gDatabaseID, tSQL, "tEndLocation","tRecordsFinal","tDeviceName","tDateAndTime"

Re: Unknown column in field list

Posted: Wed Jul 12, 2017 1:16 pm
by MaxV
Try this:

Code: Select all

answer  (tEndLocation, tRecordsFinal, tDeviceName , tDateAndTime)
put "INSERT INTO precheckopen ('LogInLocation','LogInCounter', 'DeviceName', 'DateAndTime') VALUES (':1',':2',':3',':4')" into tSQL
revExecuteSQL gDatabaseID, tSQL,"tEndLocation","tRecordsFinal","tDeviceName","tDateAndTime"
It seems that:
  • tEndLocation = ""
  • tRecordsFinal=""
  • tDeviceName=
  • tDateAndTime=
Quoting values reduces interpretation errors of MySQL