Add row to table in SQL Database

Bind your ignition table ‘Data’ property to a database table using an SQL Query.
Then you can add rows to the database table with the code below.
The ‘system.db.refresh’ function will update your ignition table.

string = event.source.parent.getComponent('Group').getComponent('Text Field').text
string2 = event.source.parent.getComponent('Group').getComponent('Text Field 1').text
string3 = event.source.parent.getComponent('Group').getComponent('Text Field 3').text
string4 = event.source.parent.getComponent('Group').getComponent('Text Field 2').text
string5 = event.source.parent.getComponent('Group').getComponent('Text Area').text
number = event.source.parent.getComponent('Group').getComponent('Numeric Text Field').intValue
table = event.source.parent.getComponent('Table')

db = "MyDatabase"

# Create the insert query
insertQuery = """INSERT INTO [%s] ([string], [string2], [string3], [string4], [string5], [number]) 
				 VALUES ('%s', '%s', '%s', '%s', '%s', %d)""" % (tableName, string, string2, string3, string4, string5, number)

# Insert the record in the database table
system.db.runUpdateQuery(insertQuery,db)

# Refresh the table data
system.db.refresh(table, "data")