Fetch the repository succeeded.
#include "dele.h"
#include "ui_dele.h"
#include<QMessageBox>
#include<QSqlQueryModel>
#pragma execution_character_set("utf-8")//设置中文= =
dele::dele(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::dele)
{
ui->setupUi(this);
}
dele::~dele()
{
delete ui;
}
void dele::on_pushButton_exit_clicked()
{
close();
}
void dele::on_pushButton_dele_clicked()
{
QSqlQueryModel *model=new QSqlQueryModel;
QSqlQueryModel *model2=new QSqlQueryModel;
QString name,sql,sql2;
name=ui->lineEdit_name->text();
sql2="select count (*) from student where name='"+name+"'";
model2->setQuery(sql2);
QModelIndex index1=model2->index(0,0);
if(index1.data()==0)
{
QMessageBox::about(NULL,"警告","系统中并无此人");
}
else
{
sql="delete from student where name='"+name+"'";
model->setQuery(sql);
QMessageBox::about(NULL,"提示","删除成功");
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。