Hey,
I have this function that inserted the data in the data base

Qt Code:
  1. void fenetre_admin::on_pushButton_ajoutE_clicked()
  2. {
  3. QString dn,hr;
  4. dn=ui->dateEdit_DNE->date().toString("dd MM yyyy");
  5. hr=ui->timeEdit_heureE->time().toString("h:m:s");
  6. qry.prepare("insert into Etudiant (DN,heur) values ('"+dn+"','"+hr+"')");
  7. if(qry.exec()){
  8. QMessageBox::critical(this,tr("Save"),tr("Save"));
  9. conn.connClose();
  10. }else{
  11. QMessageBox::critical(this,tr("erreur::"),qry.lastError().text());
  12. }}
To copy to clipboard, switch view to plain text mode 



Qt Code:
  1. {
  2. QString mat;
  3. mat=ui->lineEdit_rechmatE->text();
  4. qry.prepare("Select DN,heur from Etudiant where Matricu='"+mat+"');
  5. if(qry.exec()){
  6. while(qry.next()){
  7. ui->dateEdit_DNE->setDate(qry.value0).toString());
  8. ui->timeEdit_heureE->setTime(qry.value(1)toString());
  9. }
  10. }
To copy to clipboard, switch view to plain text mode 

type dn in the data base DATE
type hr in base data TIMESTAMP

the problem that the data does not appear in dateEdit and timeEdit