1 void MainWindow::on_updateButton_clicked()
2 {
3     if (ui->updateEdit->text() == "" || ui->coEdit->text() == "") {
4       QMessageBox::information(this, "Warning", "Student number or Course is empty");
5        return;
6    }
7    int sno = ui->updateEdit->text().toInt();
8    QString co = ui->coEdit->text();
9    QSqlQuery q;
10   QString qs = "update  Student set Course = '" + co + "'  where stNo = '" + QString::number(sno) + "' ";
11    q.exec(qs);
12    if (q.numRowsAffected() == 0) {
13      QMessageBox::information(this, "Error", "Record not Found");
14      return;
15    }
16    else
17      QMessageBox::information(this, "Success", "Record was updated");
18 }
