• 张北海
    了解作者
  • C/C++
    开发工具
  • 1.6MB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 6
    下载次数
  • 2020-04-20 21:30
    上传日期
实现了一个用户交互的学生信息管理系统,后端连接MYSQL数据库。
数据库.rar
  • 数据库
  • adminretake.ui
    4.5KB
  • main.cpp
    183B
  • admindepartment.ui
    3.8KB
  • mainwindow.qrc
    116B
  • studentcheckcourseall.cpp
    1.1KB
  • adminretake.cpp
    5.3KB
  • adminretakeall.h
    475B
  • studentmima.cpp
    2.3KB
  • untitled1.pro
    3.1KB
  • adminstudentinfor.cpp
    7.8KB
  • studentmima.h
    512B
  • student.jpeg
    249.7KB
  • admindepartment.cpp
    4KB
  • adminretakethis.ui
    1.8KB
  • adminstudentinfor.h
    658B
  • admin3.qrc
    94B
  • admin.jpeg
    1.2MB
  • adminlogin.ui
    3.1KB
  • admincourse.h
    620B
  • mainwindow.h
    792B
  • studentcheckcourse.h
    566B
  • new.qrc
    102B
  • adminscoreentry.cpp
    6.2KB
  • admincoursecheckall.h
    515B
  • adminstudentinforcheckall.cpp
    1.2KB
  • studentmima.ui
    2.5KB
  • adminscoreentry.ui
    5.9KB
  • adminscoreentrythiscourse.ui
    1.9KB
  • studentcheckscoreall.ui
    2.2KB
  • adminawardpunish.ui
    4.7KB
  • studentcheckscore.h
    558B
  • adminretakethis.h
    483B
  • studentchoosecourse.ui
    3KB
  • studentchoosecourse.cpp
    5.3KB
  • student.qrc
    96B
  • admin.qrc
    116B
  • adminlogin.cpp
    1.8KB
  • admincoursecheckall.ui
    2.7KB
  • studentcheckcourse.cpp
    2.7KB
  • admincourse.cpp
    7.2KB
  • studentcheckcourseall.ui
    2.6KB
  • adminstudentinforcheckall.h
    563B
  • adminscoreentrythisstudent.h
    567B
  • admin2.qrc
    116B
  • adminscoreentry.h
    612B
  • admincourse.ui
    8.4KB
  • studentlogin.ui
    2.6KB
  • adminscoreentrythiscourse.h
    559B
  • globel.cpp
    457B
  • admindepartment.h
    623B
  • adminstudentinfor.ui
    10.7KB
  • adminretakeall.cpp
    1.1KB
  • globel.h
    575B
  • admincoursecheckall.cpp
    2.4KB
  • adminretakeall.ui
    2KB
  • adminlogin.h
    650B
  • studentcheckscoreall.cpp
    1.1KB
  • mainwindow.cpp
    3.9KB
  • studentcheckscore.ui
    4.2KB
  • studentchoosecourse.h
    579B
  • mainwindow.ui
    4.2KB
  • studentlogin.cpp
    1.4KB
  • adminscoreentrythisstudent.ui
    2.3KB
  • studentcheckcourse.ui
    7.2KB
  • 1575962201560.jpeg
    169.8KB
  • adminawardpunish.cpp
    2.7KB
  • adminawardpunish.h
    554B
  • studentcheckcourseall.h
    531B
  • admindepall.h
    451B
  • admindepall.ui
    1.8KB
  • adminretake.h
    583B
  • untitled1.pro.user
    23.8KB
  • studentlogin.h
    642B
  • adminretakethis.cpp
    1.1KB
  • studentcheckscoreall.h
    523B
  • adminscoreentrythiscourse.cpp
    1.2KB
  • adminscoreentrythisstudent.cpp
    1.2KB
  • studentcheckscore.cpp
    2KB
  • admindepall.cpp
    1.1KB
  • adminstudentinforcheckall.ui
    2.4KB
内容介绍
#include "adminstudentinfor.h" #include "ui_adminstudentinfor.h" #include"mainwindow.h" #include"globel.h" #include"adminlogin.h" #include <QMessageBox> #include"adminstudentinforcheckall.h" #include <QPaintEvent> #include <QPainter> adminstudentinfor::adminstudentinfor(QWidget *parent) : QWidget(parent), ui(new Ui::adminstudentinfor) { ui->setupUi(this); } adminstudentinfor::~adminstudentinfor() { delete ui; } void adminstudentinfor::on_charu_clicked()//add { QString sid1=ui->xuehao1->text(); QString sid=ui->xuehao->text(); QString name=ui->xingming->text(); QString sex=ui->xingbie->text(); QString department=ui->xueyuan->text(); QString major=ui->zhuanye->text(); QString tclass=ui->banji->text(); QString id=ui->id->text(); QString password=ui->mima->text(); QString award=ui->jiangli->text(); QString punish=ui->chengfa->text(); QSqlQuery query; query.exec("select sid from student"); bool T2=true; while(query.next()) { QString sidfound= query.value(0).toString(); if(sidfound.compare(sid)==0) { QMessageBox::information(this ,tr("提示") , tr("该编号已存在不允许再次添加!")); T2=false; } } if(T2==true)//原本不存在 { QString sql; sql = QString("insert into student (sid,name,sex,department,major,class,id,password,award,punish)" " VALUES ('%1', '%2' , '%3','%4','%5','%6','%7','%8','%9','%10' )") .arg(sid).arg(name).arg(sex).arg(department).arg(major).arg(tclass).arg(id).arg(password).arg(award).arg(punish); bool ok = query.exec(sql);//提交 if(ok) { QMessageBox::information(this ,tr("提示") , tr("添加成功!")); } else { QMessageBox::information(this ,tr("提示") , tr("添加失败!")); } } } void adminstudentinfor::on_shanchu_clicked() { QString sid1=ui->xuehao1->text(); QString sid=ui->xuehao->text(); QString name=ui->xingming->text(); QString sex=ui->xingbie->text(); QString department=ui->xueyuan->text(); QString major=ui->zhuanye->text(); QString tclass=ui->banji->text(); QString id=ui->id->text(); QString password=ui->mima->text(); QString award=ui->jiangli->text(); QString punish=ui->chengfa->text(); QSqlQuery query; // db.exec("SET NAMES 'GBK'"); query.exec("select sid from student"); bool T2=true; while(query.next()) { QString sidfound= query.value(0).toString(); if(sid.compare(sidfound)==0) { QString sql; sql = QString("DELETE FROM student " " where sid = '%0' ").arg(sid); QSqlQuery query; bool ok = query.exec(sql); if(ok) { QMessageBox::information(this ,tr("提示") , tr("删除成功!")); T2=false; } else { QMessageBox::information(this ,tr("提示") , tr("删除失败!")); T2=false; } } } if(T2==true) { QMessageBox::information(this ,tr("提示") , tr("改编号不存在无法删除")); } } void adminstudentinfor::on_gengxin_clicked() { QString sid1=ui->xuehao1->text(); QString sid=ui->xuehao->text(); QString name=ui->xingming->text(); QString sex=ui->xingbie->text(); QString department=ui->xueyuan->text(); QString major=ui->zhuanye->text(); QString tclass=ui->banji->text(); QString id=ui->id->text();//身份证号 QString password=ui->mima->text(); QString award=ui->jiangli->text(); QString punish=ui->chengfa->text(); QSqlQuery query; query.exec("select sid from student"); bool T2=true; while(query.next()) { QString sidfound= query.value(0).toString(); if(sid.compare(sidfound)==0) { QString sql; sql = QString("UPDATE student " "set name='%0',sex='%1',department='%2',major='%3',class='%4',id='%5',password='%6',award='%7',punish='%8'" " where sid = '"+sid+"' ") .arg(name).arg(sex).arg(department).arg(major).arg(tclass).arg(id).arg(password).arg(award).arg(punish); QSqlQuery query; bool ok = query.exec(sql); if(ok) { QMessageBox::information(this ,tr("提示") , tr("更改成功!")); T2=false; } else { QMessageBox::information(this ,tr("提示") , tr("更改失败!")); T2=false; } } } if(T2==true) { QMessageBox::information(this ,tr("提示") , tr("该编号不存在,无法更改")); } } void adminstudentinfor::on_all_clicked() { QSqlQuery query; query.exec("select sid,name,sex,department,major,class,award,punish from student"); while(query.next()) { QStringList q; q.clear(); QString sid = query.value(0).toString(); QString name = query.value(1).toString(); QString sex = query.value(2).toString(); QString department =query.value(3).toString(); QString major=query.value(4).toString(); QString tclass=query.value(5).toString(); QString award=query.value(6).toString(); QString punish=query.value(7).toString(); q<<sid<<name<<sex<<department<<major<<tclass<<award<<punish; list_all_student.append(q); } this- rel='nofollow' onclick='return false;'>hide(); adminstudentinforcheckall *rt=new adminstudentinforcheckall; rt->show(); } void adminstudentinfor::on_chaxun_clicked() { QSqlQuery query; //query.exec("SET NAMES 'GBK'"); QString sid1=ui->xuehao1->text(); QString sid=ui->xuehao->text(); query.exec("select sid,name,sex,department,major,class,id,password,award,punish from student where sid='"+sid1+"'"); if(query.next()) { // qDebug()<<"第一条数据为"<<query.value(0).toString(); ui->xuehao->setText(query.value(0).toString()); ui->xingming->setText(query.value(1).toString()); ui->xingbie->setText(query.value(2).toString()); ui->xueyuan->setText(query.value(3).toString()); ui->zhuanye->setText(query.value(4).toString()); ui->banji->setText(query.value(5).toString()); ui->id->setText(query.value(6).toString()); ui->mima->setText(query.value(7).toString()); ui->jiangli->setText(query.value(8).toString()); ui->chengfa->setText(query.value(9).toString()); } else { if(sid.compare("")==0)//空是什么意思?? return; else QMessageBox::information(this, "警告", "不存在你所要查找的编号"); } } void adminstudentinfor::on_fanhui_clicked() { this->hide(); adminlogin *dg=new adminlogin; dg->show(); } void adminstudentinfor::paintEvent (QPaintEvent *event) { QPainter painter(this); painter.drawPixmap(rect(), QPixmap(":/admin.jpeg"), QRect()); }
评论
    相关推荐
    • QT数据库的操作
      QT自带数据库的建立,连接,以及对数据库里的各种数据的存储,插入,删除等各种操作
    • QT5数据库相关
      QT5的开发人员在没时间编译或紧急使用时直接调用,无须编译。
    • QT数据库操作实例
      自己写的一个简单的QT实例,数据库的简单的增删改操作,以及导出数据到excel中,适合于学习。
    • Qt连接数据库
      Qt连接数据库简单代码,连接字符串让人疑惑,供入门和做笔记用
    • QT链接数据库
      QT数据库的链接,并解决了数据库录入中文后,QT显示问题。
    • QT sqlite数据库
      利用Qt 编写的数据库文件,简单的实现数据库功能
    • qt数据库编程
      qt数据库编程技术,代码
    • qt Access数据库连接
      基于qt的Access数据库连接与查询源代码,已测试通过
    • QT数据库操作实例
      自己写的一个简单的QT实例,数据库的简单的增删改操作,以及导出数据到excel中,适合于学习。 自己写的一个简单的QT实例,数据库的简单的增删改操作,以及导出数据到excel中,适合于学习。
    • QT数据库操作
      本人在做项目里用到的数据库操作,对于用QT项目的服务器。