i wrote following code....
QSqlDatabase db=QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("new.db");
but i couldn't find the database in that folder.....is it not creating the database or the code is wrong????please help..........
Printable View
i wrote following code....
QSqlDatabase db=QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("new.db");
but i couldn't find the database in that folder.....is it not creating the database or the code is wrong????please help..........
Have you opened the database yet? If so, the database will be created in the current working directory for the running application since you have not specified a path. If you have not yet opened the database, it will not be created until it's opened.
Hope that helps.
If memory serves, Sqlite file will not create the actual file until after you create tables in it.
Perhaps the QSqlDatabase driver for SQLITE has this behavior, but the sqlite3 command line program will create an empty database as long as you do something that opens the database:
Code:
sqlite3 test.sqlite "select * from sqlite_master"
The above on a non-existent database will result in zero byte file being created.