Hello, I’m having a issue when I’m trying to insert some data into a DB made in mysql,… I’m using the system.db.runPrepUpdate… well the scrip I’m trying to use is this…
system.db.runPrepUpdate("INSERT INTO visiontable (Modelo) VALUES (?)",['5']);
I’m using this script in a momentary button just to see I can write data in my table… when i solve it i will try to sent values from my plc to ignition and try to reed it and write it in the db in mysql and also visualize this table in my ignition hmi…
Check in your project properties to make sure that the default database is set. It will be shown similar to the screenshot below. If that doesn’t work, confirm that the database is connected at the gateway level.
I’m having the same problem and I was thinking that it is a problem with the database connection. Can you please explain how do I specify the database connection?
I’m trying using this code into a tag event to update a table into a database called KPV but it doesn’t work. I’m not sure if the syntax is ok. Any commento or advice is welcome.
Best regards.
if alarmName == "Alarm_1_DryRoom_HighTemp_SL":
query = "UPDATE FINAL_DRY SET %s = ? WHERE Status = ?" % (TempHum_Impact)
args = ['1', 'On going']
database = "KPV"
system.db.runPrepUpdate(query, [args], database)