juliano.gomes
10th January 2016, 00:19
Hello!
I'm building and testing my release app for windows. My app use sqlite3 as database.
In my development machine, where Qt sdk is installed and configured, the app recognise the database and all works as well ( i can see, insert, and update my table data in all my forms), but when i copy my app to a pendrive and test it in another machine, only with windows installed, my app do not recognise the database, and my forms do not show the tables data.
I've already done all kind of test as i known, and i dont known if the problem is with my code, if is needed install the sqlite on machine, or put some dll in my app folder, or another?...
My connection:
QString _DB = QDir::toNativeSeparators(qApp->applicationDirPath()+"/db.db"); // database path
QSqlDatabase con = QSqlDatabase::addDatabase("QSQLITE");
con.setDatabaseName(_DB);
con.open();
// code example below
QSqlTableModel *model = new QSqlTableModel(this, con);
model->setTable("my_table");
model->setHeaderData(0, Qt::Horizontal, tr("ID"));
model->setHeaderData(1, Qt::Horizontal, tr("Name"));
model->setHeaderData(2, Qt::Horizontal, tr("Phone"));
model->select();
ui->TableView->setModel(model);
con.close();
the app folder structure:
E:\app
+ platforms (folder with qwindows.dll and qwindowsd.dll)
- db.db
- icudt53.dll
- icuin53.dll
- icuuc53.dll
- libgcc_s_dw2-1.dll
- libstdc++-6.dll
- libwinpthread-1.dll
- Qt5Core.dll
- Qt5Gui.dll
- Qt5Sql.dll
- Qt5Sqld.dll
- Qt5Widgets.dll
- app.exe
can someone help me?
thanks so much!
Juliano
I'm building and testing my release app for windows. My app use sqlite3 as database.
In my development machine, where Qt sdk is installed and configured, the app recognise the database and all works as well ( i can see, insert, and update my table data in all my forms), but when i copy my app to a pendrive and test it in another machine, only with windows installed, my app do not recognise the database, and my forms do not show the tables data.
I've already done all kind of test as i known, and i dont known if the problem is with my code, if is needed install the sqlite on machine, or put some dll in my app folder, or another?...
My connection:
QString _DB = QDir::toNativeSeparators(qApp->applicationDirPath()+"/db.db"); // database path
QSqlDatabase con = QSqlDatabase::addDatabase("QSQLITE");
con.setDatabaseName(_DB);
con.open();
// code example below
QSqlTableModel *model = new QSqlTableModel(this, con);
model->setTable("my_table");
model->setHeaderData(0, Qt::Horizontal, tr("ID"));
model->setHeaderData(1, Qt::Horizontal, tr("Name"));
model->setHeaderData(2, Qt::Horizontal, tr("Phone"));
model->select();
ui->TableView->setModel(model);
con.close();
the app folder structure:
E:\app
+ platforms (folder with qwindows.dll and qwindowsd.dll)
- db.db
- icudt53.dll
- icuin53.dll
- icuuc53.dll
- libgcc_s_dw2-1.dll
- libstdc++-6.dll
- libwinpthread-1.dll
- Qt5Core.dll
- Qt5Gui.dll
- Qt5Sql.dll
- Qt5Sqld.dll
- Qt5Widgets.dll
- app.exe
can someone help me?
thanks so much!
Juliano