UID:527
UID:2
void CompanyDialog::on_table_beforeUpdate(int row, QSqlRecord &record){ if (record.isNull("pccode") == false && record.value("pccode").toString() == "") { QMessageBox::information(this, "提示信息", "计算机代码不能为空且必须唯一", "确定"); record.setGenerated("pccode", false); } if (record.isNull("pname") == false && record.value("pname").toString() == "") { QMessageBox::information(this, "提示信息", "扣缴义务人名称不能为空且必须唯一", "确定"); record.setGenerated("pname", false); }}void CompanyDialog::on_table_beforeInsert(QSqlRecord &record){ if (record.value("pccode").toString() == "" || record.value("pname").toString() == "") { QMessageBox::information(this, "提示信息", "计算机代码和扣缴义务人名称不能为空且必须唯一", "确定"); record.clear(); table.removeRow(table.rowCount() - 1); }}