I have a maintenance screen/page where the sole purpose is to insert, update, delete rows from a MySQL table. The MySQL tables are already created and some have data that I imported.
Issue:
I can’t seem to insert a copy of the screen/page I created but it has 2 fields. A text field and a drop down. And there’s a “Add” button.
In_Location_Name = event.source.parent.getComponent(‘txtNewLocation’).text
In_Location_Type = event.source.parent.getComponent(‘ddLocationType’).selectedValue
In_Table = event.source.parent.getComponent(‘locations’)
Insert_Query = “Insert Into locations (Location_Name, Location_Type) Values (’?’,’?’)”
args = [In_Location_name, In_Location_Type]
system.db.runPrepUpdate(Insert_Query, args, database = ‘MySQL’)
Questions:
-
Is this the correct format to use to insert a row of data into a MySQL table using the mouse click event?
-
When I run it, I don’t get any errors. Perhaps there is something I need to set up to capture errors.
My apologies upfront. I was an Oracle programmer and used VB. Ignition is totally new to me.
Thanks in advance.