Hi,
Qt Code:
  1. METHOD1()
  2. {
  3. if(db.open())
  4. {
  5.  
  6. QSqlDatabase db=QSqlDatabase::addDatabase("QSQLITE");
  7. db.setDatabaseName("/mnt/jffs2/Offlinedb.sqlite");
  8. QSqlQuery query("select * from networkmode");
  9. while (query.next()) {
  10. QString country = query.value(0).toString();
  11. QMessageBox::critical(0,"Success",country,QMessageBox::Ok);
  12.  
  13. }
  14. }
  15. else
  16. {
  17. QMessageBox::critical(0,"Error","Database Connection Problem",QMessageBox::Ok);
  18. }
  19. }
To copy to clipboard, switch view to plain text mode 
-------------------------
Qt Code:
  1. method2()
  2. {
  3. QSqlDatabase db=QSqlDatabase::addDatabase("QSQLITE");
  4. db.setDatabaseName("/mnt/jffs2/Offlinedb.sqlite");
  5. QSqlQuery query;
  6. if(db.open())
  7. {
  8. bool ch=query.exec("select * from networkmode");
  9. qDebug()<<"REQUIRED CH______REGQISSSSSs"<<ch;
  10. if(ch)
  11. QMessageBox::critical(0,"Success","Database Conected",QMessageBox::Ok);
  12. else
  13. QMessageBox::critical(0,"Error",query.lastError().text(),QMessageBox::Ok);
  14. }
  15. else
  16. {
  17. QMessageBox::critical(0,"Error","Database Connection Problem",QMessageBox::Ok);
  18. }
  19.  
  20. }
To copy to clipboard, switch view to plain text mode 


->The METHOD1 is executing with no issues but when i follow method2 procedure i am getting the error as "out of memory Unable to execute statement" from line13......Y is to so behaving odd ????
->i am calling those methods in constructor.