I'm not sure if I understand.

using the database reference you retrieved at line three.
that's what I'm trying to do, just to use the recall of database connection.

Or, you can create the database connection (i.e addDatabase()) in the first place without a name making it the default connection and all subsequent QSqlQuery objects will associate with that by default.
I'm aware about this option. i think using a connection name is safer. it leaves no space for potential error.

When you call addDatabase() multiple times you ...
I'm not calling addDatabase multiple times. Is just once in 1.cpp line 3.

No, you are still missing the point. The QSqlQuery at line 10 should be created thus:
Qt Code:
QSqlQuery q1(addConn);
I tried and is not recognizing the addConn. error: adConn was not declared in this scope.

i tried
Qt Code:
  1. QSqlQuery q1("addConn")
To copy to clipboard, switch view to plain text mode 
and gives me the below error:
QSqlQuery::exec: database not open
QSqlQuery:repare: database not open
Query Error: "Driver not loaded Driver not loaded"
QSqlDatabasePrivate::removeDatabase: connection 'adUserConn' is still in use, all queries will cease to work.
the only solution working is the one described in post 14.

i will remove the
Qt Code:
  1. QSqlDatabase::removeDatabase("addConn");
To copy to clipboard, switch view to plain text mode 
, close the database connection with
Qt Code:
  1. addUser.database("addConn").close();
To copy to clipboard, switch view to plain text mode 

and
leaving clean up for program exit.
I wait and see if other errors strike against the current one. thanks for your support.