Hi to all,
I'm having some problems binding values in a "SELECT" statement on a table, maybe the code will explain better:

Qt Code:
  1. void frmLogin::submit()
  2. {
  3. QString strQuery;
  4. QString strName;
  5. QString strPass;
  6.  
  7. strQuery = "SELECT * FROM tbUtente WHERE utenteName=':name';"; //doesn't work
  8. //strQuery = "SELECT * FROM tbUtente;"; //it works
  9. strName = ui.lneUser->text();
  10. strPass = ui.lnePwd->text();
  11. /*
  12.   qDebug() << "Nome: " << strName;
  13.   qDebug() << "Pass: " << strPass;
  14.   */
  15.  
  16. QSqlQuery queryUser;
  17. queryUser.prepare(strQuery);
  18. queryUser.bindValue(":name", strName); //doesn't work
  19. // without bind a value it works
  20. queryUser.exec();
  21.  
  22. while (queryUser.next())
  23. {
  24. qDebug() << "Nome: " << queryUser.value(1).toString();
  25. qDebug() << "Pass: " << queryUser.value(2).toString();
  26. }
  27.  
  28. QSqlRecord rec = queryUser.record();
  29.  
  30. if (rec.count() >= 1)
  31. {
  32. this->accept();
  33. qDebug() << "Ok submit!";
  34. }
  35. else
  36. {
  37.  
  38. ui.lneUser->clear();
  39. ui.lnePwd->clear();
  40. ui.lneUser->setFocus();
  41. }
  42.  
  43. userName = ui.lneUser->text();
  44. }
To copy to clipboard, switch view to plain text mode 

so, if I use the "//doesn't work" instrutcions (line 7 and line 18) it doesn't return a value, instead, if I comment line 7 and 18 and run line 8 it returns all the values!!!
Why it happens?!

thanks in advance
PS: I'm using Qt 4.5.0, Sqlite3 database and WinXP.