# SQL Error

**URL:** <https://forum.inductiveautomation.com/t/sql-error/10629>\
**Category:** Ignition\
**Created:** [October 15, 2015, 6:10pm UTC](https://forum.inductiveautomation.com/t/sql-error/10629 "2015-10-15T18:10:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alewayhar](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@alewayhar](https://forum.inductiveautomation.com/u/alewayhar)\
**Post date:** [October 15, 2015, 6:10pm UTC](https://forum.inductiveautomation.com/t/sql-error/10629/1 "2015-10-15T18:10:30Z")

</div>

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:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/76d1620bec252bfac07050c889ff5a91dc8a9c25.gif ":scratch:") A little confused to say the least

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [October 15, 2015, 6:46pm UTC](https://forum.inductiveautomation.com/t/sql-error/10629/2 "2015-10-15T18:46:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [October 15, 2015, 6:54pm UTC](https://forum.inductiveautomation.com/t/sql-error/10629/3 "2015-10-15T18:54:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alewayhar](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@alewayhar](https://forum.inductiveautomation.com/u/alewayhar)\
**Post date:** [October 15, 2015, 7:00pm UTC](https://forum.inductiveautomation.com/t/sql-error/10629/4 "2015-10-15T19:00:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alewayhar](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@alewayhar](https://forum.inductiveautomation.com/u/alewayhar)\
**Post date:** [October 15, 2015, 7:02pm UTC](https://forum.inductiveautomation.com/t/sql-error/10629/5 "2015-10-15T19:02:24Z")

</div>

THANK YOU JGJOHNSON!!! I now feel like an idiot for not seeing it, but thank you thank you thank you!!! 😆😆😆 ![:thumb_right:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/2026e28c0c425034352c1b75807edf956adc75f4.gif ":thumb\_right:") ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:")
