I installed SQLite3 (unpacked to c:/sqlite), created a database (c:/sqlite/mzsales). Now I am trying to show its content in a QTableView.
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setHostName("localhost");
db.setDatabaseName("mzsales");
bool db_ok = db.open();
db_ok is true. Then
QSqlTableModel *model = new QSqlTableModel(0, db);
model->setTable("person");
model->setEditStrategy(QSqlTableModel::OnManualSubmit);
bool tbl_ok = model->select();
tbl_ok is false.
What do I do wrong? How do I connect to db? Thanks!
Got the answer. Here it is:
No need to connect, just specify the path and all is done.