Hi
I'm using sqlite with Qt library
 
	
	- #include <QtSql/QSqlDatabase> 
- #include <QSqlQuery> 
        #include <QtSql/QSqlDatabase>
#include <QSqlQuery>
To copy to clipboard, switch view to plain text mode 
  this is my code for connection : 
	
	-    mydb.open(); 
-     if (mydb.open()) 
-     { 
-         query.exec(); 
-         int fieldNo = query.record().indexOf("theme"); 
-         while (query.next()) { 
-             ui->cmb_themes->addItem(query.value(fieldNo).toString()); 
-         } 
-     } 
-    mydb.close(); 
        QSqlDatabase mydb = QSqlDatabase::addDatabase("QSQLITE");
    mydb.setDatabaseName(QCoreApplication::applicationDirPath() + "/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();
To copy to clipboard, switch view to plain text mode 
  
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
				
			
Bookmarks