Please give me some instance for write tag into database

hello : SIR.
i am new guy for ignition.
i can read date form MYSQL database in Ignition software before last week .
but i don’t know : how to write tags-value into Mysql database in Ignition software .
my idea is : when i click one button in HMI picture . it will write some tags-value into MYsql database .
but i don’t know :how to do it ?
certainly , another way can write tags into database will very good.

the picture is read vales from MYSQL.

# This example would gather some user entered text and insert it into the database.
  
ID_val = 10
class_val = 10
system.db.runPrepUpdate("INSERT INTO andytable1 (ID, class) VALUES (?,?)", [ID_val, class_val])

https://docs.inductiveautomation.com/display/DOC79/system.db.runPrepUpdate

Also your ID should be set in MySQL to Auto Increment, you shouldn’t be supplying the value each time

1 Like

Put the above code on the script section of your button, and turn your designer to read/write mode before putting it into preview mode and clicking