SQL Error

This is my code:

clientname = event.source.parent.getComponent('Group').getComponent('Text Field').text dateofwork = event.source.parent.getComponent('Group').getComponent('Text Field 1').text progress = event.source.parent.getComponent('Group').getComponent('Numeric Text Field').intValue sitelocation = event.source.parent.getComponent('Group').getComponent('Text Field 2').text problem = event.source.parent.getComponent('Group').getComponent('Text Field 3').text resolution = event.source.parent.getComponent('Group').getComponent('Text Area').text timespent = event.source.parent.getComponent('Text Field 3').text db = "DB" updateQuery = """UPDATE workorders SET clientname = ?, dateofwork = ?, progress = ?, sitelocation = ?, problem = ? resolution = ?, timespent = ? WHERE dateofwork = ?""" system.db.runPrepUpdate(updateQuery, [clientname, dateofwork, progress, sitelocation, problem, resolution, timespent, dateofwork], db)

I keep getting an error that says:

[quote]Traceback (most recent call last):

File “event:actionPerformed”, line 10, in

java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(UPDATE workorders SET clientname = ?, dateofwork = ?, progress = ?, sitelocation = ?, problem = ? resolution = ?, timespent = ? WHERE dateofwork = ?, [Sonerra, 6/4/2015, 75, Soaring Eagle, Bent Antennae, Reset Antennae and made sure cows could not get to it, 3 hour, 6/4/2015], DB, , false, false)

caused by Exception: Error executing system.db.runPrepUpdate(UPDATE workorders SET clientname = ?, dateofwork = ?, progress = ?, sitelocation = ?, problem = ? resolution = ?, timespent = ? WHERE dateofwork = ?, [Sonerra, 6/4/2015, 75, Soaring Eagle, Bent Antennae, Reset Antennae and made sure cows could not get to it, 3 hour, 6/4/2015], DB, , false, false)
caused by GatewayException: SQL error for "UPDATE workorders SET clientname = ?, dateofwork = ?, progress = ?, sitelocation = ?, problem = ? resolution = ?, timespent = ? WHERE dateofwork = ?": You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'resolution = 'Reset Antennae and made sure cows could not get to it', timespent ' at line 1
caused by MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'resolution = 'Reset Antennae and made sure cows could not get to it', timespent ' at line 1

Ignition v7.7.5 (b2015071516)
Java: Oracle Corporation 1.7.0_71
[/quote]

the issue I’m having is that it is saying to look at the issue at line one, but i don’t even see where any of the referenced error is in line 1! :scratch: A little confused to say the least

The part that says Line 1 is a MySQLSyntaxErrorException, not a python error, so I think it’s referring to your first (and only) line of SQL. If you notice, the top part of the error refers to line 10 in your python code.

You are missing a comma between “problem = ?” and “resolution = ?”.

Do you have any idea where my issue is? I have another script that looks almost identical to this, just different variables.

THANK YOU JGJOHNSON!!! I now feel like an idiot for not seeing it, but thank you thank you thank you!!! :laughing: :laughing: :laughing: :thumb_right: :thumb_left: