my table has 3 columns (1)id (2)firstname (3)lastname
My local variables have the following values
id = '1'
firstname = 'xxx'
lastname = 'yyy'
below query works and insert only value of id in the DB
query.exec_("insert into sportsmen (id) values('%s')" %id)
How to extend the above query to insert all 3 values (id, firstname, lastname) in one go ?
You must execute the following command:
query.exec_("insert into sportsmen (id, firstname, lastname) values('%s', '%s', '%s')" % (id, firstname, lastname))