mercredi 2 décembre 2015

How to write Sqlite DataBase in QT

I am using this code for creating "SQlite" Data base in qt. Now i have 2 question: First how can i add new record in table , and second how can i check the table exist? thanks a lot

      bool createConnection()
      {
QSqlDatabase db = QSqlDatabase::addDatabase("SQLITE");
db.setHostName("Server");
db.setDatabaseName("Message.DB");
if (!db.open()) {
    QMessageBox::critical(0, QObject::tr("Database Error"),
                          db.lastError().text());
    return false;
}

Aucun commentaire:

Enregistrer un commentaire