Hello!

If i use the following code in a Slot callback I am able to read from mysql database:
Qt Code:
  1. QSqlQuery query;
  2. query.exec("SELECT LastName FROM Experimenters WHERE ExpUserName='sag686'");
  3. while (query.next()) {
  4. QString exper = query.value(0).toString();
  5. qDebug() << exper;
  6. }
To copy to clipboard, switch view to plain text mode 

But if I use the following to Write to the database, I get error, any hints into what I might be doing wrong? The strings come from a Form's LineEdit fields.
Qt Code:
  1. QSqlQuery query;
  2. query.prepare( "INSERT INTO Clients (ExpUserName, Password, FirstName, LastName,Email, Phone, CreateDate, LastModified, HarpGroup, isActive) VALUES (:ExpUserName,:Password, :FirstName, :LastName, :Email, :Phone, :CreateDate, :LastModified, :HarpGroup, :isActive)");
  3.  
  4. query.bindValue( ":ExpUserName", expUserIDEdit->displayText() );
  5. query.bindValue( ":Password", passwordEdit->displayText() );
  6. query.bindValue( ":FirstName", firstnameEdit->displayText() );
  7. query.bindValue( ":LastName", lastnameEdit->displayText() );
  8. query.bindValue( ":Email", emailEdit->displayText() );
  9. query.bindValue( ":Phone", phoneEdit->displayText() );
  10. query.bindValue( ":CreateDate", QDate::currentDate().toString("dd,mm,yyyy") );
  11. query.bindValue( ":LastModified", QDate::currentDate().toString("dd,mm,yyyy") ) ;
  12. query.bindValue( ":HarpGroup", harpGroupCB->currentText() );
  13. query.bindValue( ":isActive", 1);
  14. if(!query.exec())
  15. qDebug() << "> Query exec() error." << query.lastError();
  16. else
  17. qDebug() << ">Query exec() success.";
To copy to clipboard, switch view to plain text mode