Help MySql Database not open
Hey, i need help to solve this.
Error: QSqlQuery::prepare: database not open
Thanks to all who help.
Check that the open call was successfull and if not at least print the error message you got
I can't understand what's happening;
@db = QSqlDatabase::addDatabase("QMYSQL","one");@
@db = QSqlDatabase::addDatabase("QMYSQL");@
SGaist, ty for reply :)
You're welcome !
If you name your connection then when creating e.g. QSqlQuery objects you also need to tell it which database connection you want to use
if you give a name to your database connection, so like Sgaist tell you, you need at open time to tell him to open this one (in your code, name was "one".
Then, if you naot give a name to the connection, this opening is for general use. It is a way to play with many different database connections...