Unsolved SQL LITE -3 DATABASE LINKING WITH QT CREATOR
-
hello,
My Qt C++ project involves SQLite databases.
I have to link SQLite-3 database with qt creator as a dynamic library.
to store my data in the database.
currently, I have given a static path ex. (/home/pi/Desktop/database.db) to the database, but I want to give a dynamic ex. (:/datbase.db) path to my database.db so
please help me regarding the dynamic path linking of SQLite lite database with qt creator. -
Hi
You can use
http://doc.qt.io/qt-5/qstandardpaths.html
to find a good location to have it stored. -
I have added my database.db file in qt creator resources and copy the path by right click on database .db.
I tried to open the database but database not open error is showing
Help me regarding this ?.. -
Hi
You cannot use Sqllite db when in a res file as its read only.
You will need to use qstandardpaths + QFile::copy and copy it to
writable location and then open it. -
@mrjj said in SQL LITE -3 DATABASE LINKING WITH QT CREATOR:
in a res fil
is ther any other way to add database in dynamic path
-
@qt_ankit_developer
Hi
what is wrong with standardpaths ?