void background::on_pushButton_3_clicked()
{
QString name, age,
/*gender, pregnant,*/ weight, height
/* family*/;
name=ui->lineEdit_name->text();
age=ui->lineEdit_age->text();
QString gender
=ui
->comboBox_gender
->currentText
();
QString pregnant
=ui
->comboBox_pregnant
->currentText
();
weight=ui->lineEdit_weight->text();
height=ui->lineEdit_height->text();
QString family
=ui
->comboBox_family
->currentText
();
myqry.prepare("INSERT INTO background(Name, Age, Gender, Pregnant, Weight, Height, Family) values('"+name+"','"+age+"','"+gender+"','"+pregnant+"','"+weight+"','"+height+"','"+family+"')");
if(myqry.exec()){
ui->labelstat->setText("The information has been saved");
// QMessageBox::information(this, "Save", "The information has been saved");
}
else{
ui->labelstat->setText("Information failed to saved");
// QMessageBox::warning(this, "Failed", "Information failed to saved");
}
}
void background::on_pushButton_3_clicked()
{
QString name, age,/*gender, pregnant,*/ weight, height/* family*/;
name=ui->lineEdit_name->text();
age=ui->lineEdit_age->text();
QString gender=ui->comboBox_gender->currentText();
QString pregnant=ui->comboBox_pregnant->currentText();
weight=ui->lineEdit_weight->text();
height=ui->lineEdit_height->text();
QString family=ui->comboBox_family->currentText();
QSqlQuery myqry;
myqry.prepare("INSERT INTO background(Name, Age, Gender, Pregnant, Weight, Height, Family) values('"+name+"','"+age+"','"+gender+"','"+pregnant+"','"+weight+"','"+height+"','"+family+"')");
if(myqry.exec()){
ui->labelstat->setText("The information has been saved");
// QMessageBox::information(this, "Save", "The information has been saved");
}
else{
ui->labelstat->setText("Information failed to saved");
// QMessageBox::warning(this, "Failed", "Information failed to saved");
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks