jeudi 8 janvier 2015

QT: How to create a SQLite database

I am trying to create a SQLite database in QT. here is my code:



QDir databasePath;
QString path = databasePath.currentPath()+"myDb.db";
QSqlDatabase dbConnection = QSqlDatabase:addDatabase("QSQLITE");
db.setDatabaseName(path);
db.open();


there is no errors when running the code, but I can't find the database I created in the path I defined. does this actually creates the database or it just do some initialization ?


if it doesnot create the database then how to create the database within the application itself (I am not talking about insertion)


Aucun commentaire:

Enregistrer un commentaire