Hi, I have the code:
Qt Code:
  1. QString CMerchandizeBrowser::getMerchandizeName(QString strPicPath)
  2. {
  3. Q_ASSERT(strPicPath.size()>0); // assertion test
  4. // use query
  5. /*
  6.   QSqlQuery useQuery("USE merchandize;");
  7.   qDebug() << useQuery.lastError(); // debug
  8. */
  9. // query string;
  10. QString queryString("SELECT * FROM `eros`.`merchandize` WHERE PicPath=\"%1\";");
  11. queryString=queryString.arg(strPicPath);
  12. qDebug() << "queryString:" << queryString; // debug
  13. QSqlQuery query(queryString); // executes sql query
  14. //Q_ASSERT(query.value(iMerchandizeFieldNAME).toString().size()>0); // assertion test
  15. qDebug() << query.lastError(); // debug: shows error
  16. qDebug() << query.value(iMerchandizeFieldNAME).toString(); // debug
  17. return(query.value(iMerchandizeFieldNAME).toString()); // returns merchandize name
  18. }
To copy to clipboard, switch view to plain text mode 

and after qDebug() << query.lastError() I get:
Qt Code:
  1. warning: QSqlError(-1, "", "")
To copy to clipboard, switch view to plain text mode 

The connection to database is ok, I've double checked. What is wrong, please help!