# runPrepUpdate help

**URL:** <https://forum.inductiveautomation.com/t/runprepupdate-help/10588>\
**Category:** Ignition\
**Created:** [October 7, 2015, 3:52am UTC](https://forum.inductiveautomation.com/t/runprepupdate-help/10588 "2015-10-07T03:52:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gratliff](https://avatars.discourse-cdn.com/v4/letter/g/a5b964/32.png) [@Gratliff](https://forum.inductiveautomation.com/u/Gratliff)\
**Post date:** [October 7, 2015, 3:52am UTC](https://forum.inductiveautomation.com/t/runprepupdate-help/10588/1 "2015-10-07T03:52:36Z")

</div>

I have the following code in the onCellEdited extension function of a power table.

I cant seem to get the runPreUpdate to work. Any assistance would be appreciated.  
IA v7.7.5

[code] import system

```
dataSource = "CapitalProjectsDB"
# The row index of the edited row
row = rowIndex
# The column index of the edited column
col = colIndex
# The name of the edited column
colName = colName
# The new value entered by the user
value = newValue

# get the ID (primary key)
ID = self.data.getValueAt(row,0)
#string that is the query section below in the runPrepUpdate
query = "UPDATE [WBS Table Detail] SET Comments = (?) WHERE ID = (?)"
# list of values represented in string above by ‘?’ marks in the values portion of runPrepUpdate
values = [value,ID]

try:
	system.db.runPrepUpdate(query,values,dataSource)
except:
    system.gui.warningBox("SQL Insert Failed")[/code]
```

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [October 7, 2015, 4:09am UTC](https://forum.inductiveautomation.com/t/runprepupdate-help/10588/2 "2015-10-07T04:09:51Z")

</div>

Hi Gratliff,

If you remove the try/except you can find out what the SQL error is.

It looks like the SQL query syntax is wrong. I would try this:

`query = "UPDATE [WBS Table Detail] SET Comments = ? WHERE ID = ?"`Best,

---

<div class="post-metadata">

**Author:** ![Gratliff](https://avatars.discourse-cdn.com/v4/letter/g/a5b964/32.png) [@Gratliff](https://forum.inductiveautomation.com/u/Gratliff)\
**Post date:** [October 7, 2015, 1:35pm UTC](https://forum.inductiveautomation.com/t/runprepupdate-help/10588/3 "2015-10-07T13:35:12Z")

</div>

Excellent! That was it. So close. Thanks Nick!
