# system.db.runPrepUpdate not working for update query, but working for insert query

**URL:** <https://forum.inductiveautomation.com/t/system-db-runprepupdate-not-working-for-update-query-but-working-for-insert-query/90856>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [May 24, 2024, 9:54am UTC](https://forum.inductiveautomation.com/t/system-db-runprepupdate-not-working-for-update-query-but-working-for-insert-query/90856 "2024-05-24T09:54:31Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 24, 2024, 12:45pm UTC](https://forum.inductiveautomation.com/t/system-db-runprepupdate-not-working-for-update-query-but-working-for-insert-query/90856/8 "2024-05-24T12:45:25Z")

</div>

If you follow the scheme I explained in answer to your other question, [Need to execute the script when it entered the perspective page - #2 by Transistor](https://forum.inductiveautomation.com/t/need-to-execute-the-script-when-it-entered-the-perspective-page/90852/2), your corrected code could be written as,

```python
query = """UPDATE drawing_master 
           SET name = ?, drawingno = ?,product = ? 
           WHERE id = ?"""
values = [self.custom.name,
		  self.custom.drawingno,
		  self.custom.product,
		  self.view.params.row_id
         ]
system.db.runPrepUpdate(query, values)

```

Which would be more readable and more robust?

---

_[View the full topic](https://forum.inductiveautomation.com/t/system-db-runprepupdate-not-working-for-update-query-but-working-for-insert-query/90856)._
