【发布时间】:2016-09-14 05:15:06
【问题描述】:
QSqlQuery insert_emi_query;
insert_emi_query.prepare("INSERT INTO emi_info (emi-info_id, customer_id, down_payment, emi_start_date, emi_end_date, emi_amount, toatl_emi, intrest_rate, total_emi_amount) "
"VALUES(:emi-info_id, :customer_id, :down_payment, :emi_start_date, :emi_end_date, :emi_amount, :toatl_emi, :intrest_rate, :total_emi_amount)");
insert_emi_query.bindValue(":emi-info_id",emi_id);
insert_emi_query.bindValue(":customer_id",cutomer_id);
insert_emi_query.bindValue(":down_payment",ui->txtEMIDownPayment->text().toInt());
insert_emi_query.bindValue(":emi_start_date",ui->dateEMIStart->date());
insert_emi_query.bindValue(":emi_end_date",ui->dateEMIEnd->date());
insert_emi_query.bindValue(":emi_amount",ui->txtEMIPerMonth->text().toInt());
insert_emi_query.bindValue(":toatl_emi",ui->spinEMI->text().toInt());
insert_emi_query.bindValue(":intrest_rate",ui->txtEMIRate->text().toInt());
insert_emi_query.bindValue(":total_emi_amount",ui->txtEMIAfterPayment->text().toInt());
if(insert_emi_query.exec()){
qDebug() << "EMI Info Added---------------------";
}else{
qDebug() << "EMi not inserted" << insert_emi_query.lastError();
}
【问题讨论】:
-
您能否提供有关您尝试插入的表的架构的更多信息?
-
很好,现在看起来可读了。