PDA

View Full Version : Database to display all rows on a table



Handy77
11th May 2016, 23:05
ref = self.ref_lineEdit.text()

connection = sqlite3.connect("db.db")
result = connection.cursor()
result = connection.execute("SELECT * FROM order WHERE ref = '"+ref+"'")
data = result.fetchall()
connection.close()

I want to get the information from database table to display all rows on a qttable. Can some help me get this information to display on table. like a list

thank you

Lesiok
12th May 2016, 19:40
Use QTableWidget with QSqlTableModel

anda_skoa
13th May 2016, 10:40
Use QTableWidget with QSqlTableModel
QTableView but yes.

Or create a table model derived from QAbstractTableModel and use your SQL API.

Cheers,
_