# Delete rows from a table

**URL:** <https://forum.inductiveautomation.com/t/delete-rows-from-a-table/8146>\
**Category:** Ignition\
**Created:** [March 12, 2014, 9:38pm UTC](https://forum.inductiveautomation.com/t/delete-rows-from-a-table/8146 "2014-03-12T21:38:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![controlsim](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@controlsim](https://forum.inductiveautomation.com/u/controlsim)\
**Post date:** [March 12, 2014, 9:38pm UTC](https://forum.inductiveautomation.com/t/delete-rows-from-a-table/8146/1 "2014-03-12T21:38:45Z")

</div>

hi, i trying to delete row from a table but i get an error,

i have a dropdown list and a button with this script:

```auto
delete = event.source.parent.getComponent('Dropdown').selectedStringValue
system.db.runUpdateQuery("DELETE FROM inventory where name = ?",[delete])
```

i get this error

```auto
java.lang.Exception: java.lang.Exception: Error executing system.db.runUpdateQuery(DELETE FROM inventory where name = ?, [u'Product4'], , false)

	caused by Exception: Error executing system.db.runUpdateQuery(DELETE FROM inventory where name = ?, [u'Product4'], , false)
	caused by GatewayException: Connection Error: Datasource "[u'Product4']" does not exist in this Gateway.
	caused by SQLException: Datasource "[u'Product4']" does not exist in this Gateway.

```

---

<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:** [March 12, 2014, 9:42pm UTC](https://forum.inductiveautomation.com/t/delete-rows-from-a-table/8146/2 "2014-03-12T21:42:48Z")

</div>

You are calling the wrong database function.

Try this one: system.db.runPrepUpdate

---

<div class="post-metadata">

**Author:** ![controlsim](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@controlsim](https://forum.inductiveautomation.com/u/controlsim)\
**Post date:** [March 12, 2014, 10:22pm UTC](https://forum.inductiveautomation.com/t/delete-rows-from-a-table/8146/3 "2014-03-12T22:22:35Z")

</div>

Thanks! that worked
