Originally Posted by Spitfire You're showing wrong part of your code. Error is generated by the part that executes a query not sets up the database. You're probably not using connection name there. When creating the query you have to specify which connection you want to use: Qt Code: Switch view QSqlQuery query( QSqlDatabase::database( "StockManagerConn" ) ); QSqlQuery query( QSqlDatabase::database( "StockManagerConn" ) ); To copy to clipboard, switch view to plain text mode otherwise it will fall back on the default name and fail. Thank you so much you are right. When declaring my QSqlQuery i changed it to add the connection and it worked great. You are a star.
QSqlQuery query( QSqlDatabase::database( "StockManagerConn" ) );
I'm glad I could help Take care!
Forum Rules
Bookmarks