1 Star 2 Fork 0

735754647/Qt基于数据库的学生管理系统

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
dele.cpp 949 Bytes
Copy Edit Raw Blame History
735754647 authored 2022-04-21 08:32 . 第一次提交
#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,"提示","删除成功");
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/a735754647/student.git
git@gitee.com:a735754647/student.git
a735754647
student
Qt基于数据库的学生管理系统
master

Search