Hi
My database coonection is working but my Query is not executed.please see my process may be i wrong in add existing file.
->i have a sqlit database CabBookingDatabase.sqlite
->i copy this database in c drive.
->i make a new project after make my project i add existing file choose CabBookingDatabase.sqlite,from c drive .
->is any other method to add database please help me because my Query will not executed.
please see my code
#include "ui_mainwindow.h"
#include <QtCore>
#include<QtGui>
#include <QtSql/QSqlDatabase>
#include<QtSql/QSqlError>
#include <QMessageBox>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
db=QSqlDatabase::addDatabase("QSQLITE");
//QSqlDatabase::addDatabase("CabBookingDatabase.sqli te");
db.setDatabaseName("C:\CabBookingDatabase.sqlite") ;
if (db.open())
{
QMessageBox msgBox;
msgBox.setText("Database cOnnected.");
msgBox.exec();
}
else{
QMessageBox::critical(0, QObject::tr("Database Error"),
db.lastError().text());
}

QSqlQuery query(QString("SELECT * FROM City"));
query.exec();
if (query.next())
{

QMessageBox msgBox;
msgBox.setText(query.value(2).toString());
msgBox.exec();

}

}

////////////.pro//////
QT += sql


please help me

Thanks