Quote Originally Posted by Spitfire View Post
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:
  1. 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.