If you opens db connection in 1.cpp file in 2.cpp file You use it like this :Reading the documentation does not hurt. From QSqlDatabase::QSqlDatabase doc : Creates an empty, invalid QSqlDatabase object. Use addDatabase(), removeDatabase(), and database() to get valid QSqlDatabase objects.Qt Code:
QSqlQuery qry1; qr1.prepare(...); ... customer.close();To copy to clipboard, switch view to plain text mode
Bookmarks