getting already open database connection
-
Don't think this has something to do with the other database connection. I would take a look at the query where it fails, and check what QSqlQuery::error() and database() really returns.
wrote on 3 Feb 2020, 19:25 last edited by user4592357 2 Mar 2020, 19:25@Christian-Ehrlicher
the error is fromQSqlQuery::lastError()
.
and it worked with default connection -
Please show the query, make sure that the db is really open at the time you're trying to execute the query.
-
Hi,
To add to @Christian-Ehrlicher, I am not sure that using a file path is necessarily a good idea for a connection name.
-
Hi,
To add to @Christian-Ehrlicher, I am not sure that using a file path is necessarily a good idea for a connection name.
wrote on 3 Feb 2020, 19:29 last edited by@SGaist
then what should i be using? -
A meaningful identifier, just the name of the database, etc. That's up to you.
-
wrote on 3 Feb 2020, 19:33 last edited by
@SGaist
yeah something unique, so i thought file path would be more unique then fine name -
In any case, you should do as @Christian-Ehrlicher wrote: get the error from the failed query.
-
In any case, you should do as @Christian-Ehrlicher wrote: get the error from the failed query.
wrote on 3 Feb 2020, 19:43 last edited by user4592357 2 Mar 2020, 19:43@SGaist
the parameter mismatch error is the text given bylastError()
-
And what is the query ? The one returned by lastQuery ?
-
wrote on 4 Feb 2020, 06:54 last edited by
actually
prepare()
was failing and i got the error from sql query at right after prepare() and it was meaningful
12/12