Inserting rows in the specified database table
In this recipe, we will be learning to insert rows into a table. We assume a table called Users
consisting of two columns, EmailAddress
and Password
, already exists in a database called ECommerce
.
After entering the email address and password in the respective Line Edit
widgets, when the user clicks the Insert Row
button, the row will be inserted into the specified database table.
How to do it…
Here are the steps to insert rows into a database table that exists in SQLite:
- Let's create an application based on the
Dialog without Buttons
template. - Add five
QLabel
widgets, fourQLineEdit
widgets, and oneÂQPushButton
widgets to the form by dragging and dropping fiveLabel
widgets, fourLine Edit
widgtes, and oneÂPush Button
widget on the form. - Set the
text
property of the first fourLabel
widgets toEnter database name
,Enter table name
,Email Address
, andPassword
. - Delete the
text
property of the fifthLabel
widget this is established through code. - Set...