mr.farahmand
3rd February 2012, 10:34
Hi
I'm using sqlite with Qt library
#include <QtSql/QSqlDatabase>
#include <QSqlQuery>
this is my code for connection :
QSqlDatabase mydb = QSqlDatabase::addDatabase("QSQLITE");
mydb.setDatabaseName(QCoreApplication::application DirPath() + "/data/27115");
mydb.open();
QSqlQuery query("SELECT * FROM setting");
if (mydb.open())
{
query.exec();
int fieldNo = query.record().indexOf("theme");
while (query.next()) {
ui->cmb_themes->addItem(query.value(fieldNo).toString());
}
}
mydb.close();
Now in my system,its work right without any problem,but i copied debug folder in other computer and run, my application cant find db file!!
in other system i installed qt sdk and open myapp.pro on it,and run.. next .. db file could run and worked.why?
in my laptop with Windows7 64 bits , output address is : '.....'-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug
and in other computer with windows 7 32 bits , output address is : '.....'-build-desktop
thanks before answer
I'm using sqlite with Qt library
#include <QtSql/QSqlDatabase>
#include <QSqlQuery>
this is my code for connection :
QSqlDatabase mydb = QSqlDatabase::addDatabase("QSQLITE");
mydb.setDatabaseName(QCoreApplication::application DirPath() + "/data/27115");
mydb.open();
QSqlQuery query("SELECT * FROM setting");
if (mydb.open())
{
query.exec();
int fieldNo = query.record().indexOf("theme");
while (query.next()) {
ui->cmb_themes->addItem(query.value(fieldNo).toString());
}
}
mydb.close();
Now in my system,its work right without any problem,but i copied debug folder in other computer and run, my application cant find db file!!
in other system i installed qt sdk and open myapp.pro on it,and run.. next .. db file could run and worked.why?
in my laptop with Windows7 64 bits , output address is : '.....'-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug
and in other computer with windows 7 32 bits , output address is : '.....'-build-desktop
thanks before answer