SQLite problem loading from file and display result in table
What i want is to load .sqlite file and dimply query in table.
Unfortunately no table is displayed, just empty window.
Database file is in the project main folder.
Code:
//db.setDatabaseName(QApplication::applicationDirPath() + QDir::separator() + "faktura.sqlite");
db.setDatabaseName("faktura.sqlite");
db.open();
model->setQuery("SELECT customer_id,name, address FROM customers");
model
->setHeaderData
(0, Qt
::Horizontal,
QObject::tr("Field 1"));
model
->setHeaderData
(1, Qt
::Horizontal,
QObject::tr("Field 2"));
model
->setHeaderData
(2, Qt
::Horizontal,
QObject::tr("Field 3"));
view->setModel(model);
view->show();
Re: SQLite problem loading from file and display result in table
what is db.open() returning?
Re: SQLite problem loading from file and display result in table
Problem solved.Everything wrks fine.All i did is to move the sqlite file in the debug directory.When i start the App from there everything works.