Displaying rows in the specified database table
In this recipe, we will be learning to fetch rows from a given database table and display them in tabular format via the Table widget. We assume a table called Users consisting of two columns, EmailAddress and Password, already exists in a database called ECommerce. Also, we assume that the Users table contains some rows in it.
How to do it…
Follow this step-by-step procedure to access rows from the database table in SQLite:
- Let's create an application based on the
Dialog without Buttonstemplate. - Add three
QLabelwidgets, twoQLineEditwidgets, oneÂQPushButton, and oneÂQTableWidgetwidget to the form by dragging and dropping threeLabelwidgets, twoLine Editwidgets, oneÂPush Buttonwidget, and aTablewidget on the form. - Set the
textproperty of the twoLabelwidgets toEnter database nameandEnter table name. - Delete the
textproperty of the thirdLabelwidget because itstextproperty will be set through code. - Set the
textproperty of the push...