# system.db.runPrepUpdate("UPDATE

**URL:** <https://forum.inductiveautomation.com/t/system-db-runprepupdate-update/86488>\
**Category:** Ignition\
**Tags:** ignition81, database\
**Created:** [February 28, 2024, 7:30am UTC](https://forum.inductiveautomation.com/t/system-db-runprepupdate-update/86488 "2024-02-28T07:30:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![OscarLucas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/oscarlucas/32/6417_2.png) [@OscarLucas](https://forum.inductiveautomation.com/u/OscarLucas)\
**Post date:** [February 28, 2024, 7:30am UTC](https://forum.inductiveautomation.com/t/system-db-runprepupdate-update/86488/1 "2024-02-28T07:30:32Z")

</div>

Dear colleagues, let's see if you can help me.  
I am trying to update an existing row in my database.  
I think I have to use this statement, but I don't know how to point to the row. Nor how to write the rewrite command correctly.

system.db.runPrepUpdate("UPDATE

I leave you my code in case you can help me see where the problem is.  
The row is identified by the variable "nombre"

> nombre = event.source.parent.getComponent('Desple\_recetas\_BDD 1').selectedStringValue  
> Tiro\_V\_min = event.source.parent.getComponent('Tiro V min 1').intValue  
> databaseConnection = "BDD\_HMI"  
> system.db.runPrepUpdate("UPDATE INTO recetas (nombre, Tiro\_V\_min, tstamp) VALUES (?,?,?)", [nombre, Tiro\_V\_min, system.date.now()], databaseConnection)

I have not been able to locate an example. If they have it, it would also work for me.

> **[system.db.runPrepUpdate | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-db/system-db-runPrepUpdate)**
>
> Runs a prepared statement against the database, returning the number of rows that were affected.

Thanks to the entire community

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [February 28, 2024, 11:20am UTC](https://forum.inductiveautomation.com/t/system-db-runprepupdate-update/86488/2 "2024-02-28T11:20:19Z")

</div>

Try:

```python
system.db.runPrepUpdate("UPDATE recetas SET Tiro_V_min=?, tstamp=? WHERE nombre=?", [Tiro_V_min, system.date.now(), nombre], databaseConnection)

```

> **[SQL UPDATE Statement](https://www.w3schools.com/sql/sql_update.asp)**
>
> W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

---

<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:** [February 28, 2024, 12:31pm UTC](https://forum.inductiveautomation.com/t/system-db-runprepupdate-update/86488/3 "2024-02-28T12:31:36Z")

</div>

Hi, Oscar. Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831). The `>` markdown syntax is for quoting another source.
