I am making a contact book application in Qt. I want my application to automatically create an QSQLITE database when it first runs and then access this database in future? Is there a way to do this?
Ya you can create sqlite database at its first run and can make it progressive. Just do it in the constructor of your App and check for the existence of db before cerating it, else don't create. You can access database in subsequent runs of your same App or different App.
Use db.setDatabaseName("databasename.db"); instead of db.setDatabaseName(":memory:");, now your database will be persistent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With