help to resolve this ....

Untitled.jpg
Qt Code:
  1. #include "dialog.h"
  2. #include "ui_dialog.h"
  3. #define path_to_db "C:/Users/beethoven07/Documents/myDbVic/myDBvic.s3db"
  4.  
  5. Dialog::Dialog(QWidget *parent) :
  6. QDialog(parent),
  7. ui(new Ui::Dialog)
  8. {
  9. ui->setupUi(this);
  10. myDB = QSqlDatabase::addDatabase ("QSQLITE");
  11. myDB.setDatabaseName (path_to_db);
  12. QFileInfo checkFile (path_to_db);
  13.  
  14. if(checkFile.isFile())
  15. {
  16. if(myDB.open())
  17. {
  18. ui->lblStatus->setText("berhasil konek database");
  19. }
  20.  
  21. }else
  22. {
  23. ui->lblStatus->setText("nda ta konek di database :(");
  24. }
  25.  
  26. }
  27.  
  28. Dialog::~Dialog()
  29. {
  30. delete ui;
  31. qDebug()<< "keluar dari database pada waktu program di matikan";
  32. myDB.close();
  33. }
  34.  
  35. void Dialog::on_btnClear_clicked()
  36. {
  37. ui->txtPassword->setText("");
  38. ui->txtUsername->setText("");
  39.  
  40. }
  41.  
  42. void Dialog::on_btnLogin_clicked()
  43. {
  44. QString username, password;
  45. username = ui->txtUsername->text();
  46. password = ui->txtPassword->text();
  47.  
  48. if(!myDB.isOpen()) {
  49. qDebug() << "No connection to DB :(";
  50. return;
  51. }
  52. QSqlQuery qry;
  53. if(qry.exec("SELECT username, password, Role FROM loginform WHERE username='" + username +
  54. "\' AND password=\'" + password + "\'"))
  55. {
  56. if(qry.next())
  57. {
  58. ui->lblStatus ->setText("username dan password benar");
  59. QString msg = "username = " +qry.value(0).toString() + "\n" +
  60. "password = " +qry.value(1).toString() + "\n" +
  61. "role = " +qry.value(2).toString();
  62. QMessageBox::warning(this, "Login berhasil", msg);
  63.  
  64. } else {
  65. ui->lblStatus->setText("Sala Password atau username bego");
  66. }
  67. }
  68. }
To copy to clipboard, switch view to plain text mode 

do i did something mistake with this code?
thanks....