I am having a problem with what should be a simple script. I know I am missing something stupid and simple.
I have the following within a script on an action button:
col1_val = integerValue
col2_val = stringValue
fpmi.db.runUpdateQuery(“INSERT INTO tablename (col1, col2, t_stamp) VALUES(%d, %s, CURRENT_TIMESTAMP)” % col1_val, col2_val)
the error I am getting is when I have col2_val in the statement. If I remove the references to col2, the error goes away. The error states that I do not have enough arguments (or something like that).
I am using MYSQL, soon to be moving to MSSQL.
Thanks for any help with my lack of SQL knowledge.
Adam
[RESOLVED]
I was forgetting the parentheses around the variable names at the end of the statement as well as single quotes around the variable type:
INSERT INTO tablename (col1, col2, t_stamp) VALUES(%d, '%s’, CURRENT_TIMESTAMP)" % (col1_val, col2_val)