Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hi,
If my database data.sqlite is located in my project folder, how can I call it and read/right from it. I want the database be a part of my project, not just an external file.
@QSqlDatabase db = QSqlDatabase:addDatabase("QSQLITE"); db.setDatabaseName("data.sqlite"); bool opened = db.open();@
Also, add sql to your project's .pro, for example:
@QT += core sql QT -= gui@
@ db.setDatabaseName("data.sqlite"); @
searches in the current working directory, if that's wrong, give an absolute path as the argument.