大学生软件课程设计之新生报到管理系统

⚠️⚠️⚠️系统源码看这里!!!
链接:https://pan.baidu.com/s/1e7StyKSVbWwV5-XmovnFAw 提取码:tp6g

本次编写工具使用 Visual Studio 2019 + SQL Server2012,看清楚编辑器和数据库!!!C/S模式。工具安装百度上有详细教程,请自行百度安装。这是今年刚做的软件课程设计,仅适合完全小白的大学生!!!!
在正式编写程序之前,需要在项目的App.config中添加如下代码,进行连接数据库:

<connectionStrings>
    <clear/>
    <add name="StuDb" connectionString="Server=localhost;Database=#;User Id=#;Password=#;" providerName="System.Data.SqlClient"/>
  </connectionStrings>

代码中的(#)第一个表示你的数据库名字,第二个和第三个表示在打开你的数据库时,进行windows验证时的用户名和密码。

**

1 绪论

**
1.1系统可行性分析
运用Visual Studio 2017作为软件开发环境,SQL Server2012为开发数据库进行系统开发,能够保证系统的可行性及数据的安全性。本系统的界面清晰简单明了,管理人员无需进行专门培训即可轻松上手使用。
1.2系统需求分析
(1)学生管理:注册用户、登录系统
(2)管理员管理:查询,增加,修改,删除学生的个人信息、报到信息、注册信息

**

2 功能分析

**
2.1功能模块
该系统需要实现的是管理员、学生的系统化操作。
其功能包括:
(1) 新生注册:本系统仅限已报到学生进行注册,并且在输入用户名时,必须使用本人的真实姓名,在输入密码时,会对密码进行再次确认。
(2) 登录:登录分为管理员登录和学生登录,管理员登录时使用自己的用户名和密码,学生登录时,使用学号进行登录。
(3) 查询(管理员):当输入框为空时,可查询到所有学生的个人信息、报到信息、注册信息,输入学号后,可进行精确查找。
(4) 删除(管理员):在删除学生的个人信息时,若该学生已报到或已注册,提示先删除其报到信息或注册信息;在删除学生的报到信息时,若该学生已注册,提示先删除其的注册信息。
(5) 修改(管理员):可修改学生的部分个人信息、重置学生密码、向报到表中插入其报到时间、更新缴费情况,在宿舍管理时,可查询到所有宿舍、男生宿舍、女生宿舍的信息,修改学生的宿舍情况。
(6) 数据统计:统计新生人数、已报到人数、男生人数、女生人数、已缴费人数、已安排宿舍人数。
(7) 学生登录:登录后默认显示新生的个人信息和报到信息,个人信息仅可对联系电话进行修改,也可进行密码修改。

**

3 界面设计

**
在这里插入图片描述
**

4 数据库设计

**
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

**

5 系统实现

**
5.1登录界面
在这里插入图片描述
进入登录页面,需要选择登录用户类型(学生,管理员),否则会提示请选择用户类型。其次必须输入用户名或密码,如若有一项为空,则会提示用户名或密码为空,若两项信息有其一不匹配,则会提示用户名或密码错误。登录成功后进入的页面会根据用户选择的类型进入不同的页面,从而进行不同的操作。
下面给出管理员登录实现代码:

string connStr = ConfigurationManager.ConnectionStrings[0].ConnectionString;
SqlConnection conn = new SqlConnection(connStr);//连接数据库
conn.Open();//连接打开
name = txtUser.Text;
string pwd = txtPwd.Text;
if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(pwd))
{
     MessageBox.Show("用户名或密码不能为空!");
     return;
}
string sql = "select adName,adPwd from admin where adName='" + name + "'and adPwd='" + pwd + "'";
SqlCommand cmd = new SqlCommand(sql, conn);
SqlDataReader reader = cmd.ExecuteReader();
if (reader.HasRows)
{//用户名与账户一致则登录成功
    报到管理 baodao = new 报到管理();
    baodao.ShowDialog();
    this.Close();
}
else
{
    MessageBox.Show("用户名或密码错误!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
reader.Close();
conn.Close();//连接关闭

5.2用户注册界面
在这里插入图片描述
本系统仅允许本校已报到学生进行注册,其他人不允许注册,也不允许重复注册。在输入用户名时,必须使用自己的真实姓名,学号,用户名,密码三者皆不能为空,否则会产生提示。
下面给出部分代码:

private void btnReg_Click_1(object sender, EventArgs e)
{
     string sno = txtSno.Text;
     if (string.IsNullOrEmpty(sno))
     {
          MessageBox.Show("学号不能为空!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
          return;
      }
      string connStr = ConfigurationManager.ConnectionStrings[0].ConnectionString;
      SqlConnection conn = new SqlConnection(connStr);
      conn.Open();
      try
      {
           string sql = "select Sno from Baodao where Sno='" + sno + "'";
           SqlCommand cmd = new SqlCommand(sql, conn);
           SqlDataReader reader = cmd.ExecuteReader();
           if (!reader.HasRows)
           {
                MessageBox.Show("学号错误,你还未报到,非本校学生不允许注册,请核对你的学号是否正确!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            reader.Close();
            using (conn)
            {
                 SqlCommand cmd1 = new SqlCommand("insert into Stuser(Sno,stuName,stuPwd) values (@Sno,@stuName,@stuPwd)", conn);
                 SqlParameter parameter1 = cmd1.CreateParameter();
                 parameter1.ParameterName = "@Sno";
                 parameter1.Value = txtSno.Text;
                 cmd1.Parameters.Add(parameter1);

                 SqlParameter parameter2 = cmd1.CreateParameter();
                 parameter2.ParameterName = "@stuName";
                 parameter2.Value = txtUser.Text;
                 cmd1.Parameters.Add(parameter2);

                 SqlParameter parameter3 = cmd1.CreateParameter();
                 parameter3.ParameterName = "@stuPwd";
                 parameter3.Value = txtPwd1.Text;
                 cmd1.Parameters.Add(parameter3);

                 //密码不能为空
                 if (string.IsNullOrEmpty(txtPwd1.Text))
                 {
                     MessageBox.Show("密码不能为空!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     return;
                 }

                 //核对前后输入密码是否一致
                 string pwd2 = txtPwd2.Text;
                 if (parameter3.Value.ToString() != pwd2)
                 {
                     MessageBox.Show("前后密码不一致,请认真核对!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     return;
                 }
                 cmd1.ExecuteNonQuery();
                 MessageBox.Show("注册成功,请返回登录!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
      }
      catch (Exception ex)
      {//操作数据库出错情况
           MessageBox.Show(ex.Message, "操作数据库出错", MessageBoxButtons.OK, MessageBoxIcon.Error);
       }
       conn.Close();
       this.Close();
}

5.3管理员界面
在这里插入图片描述
登录成功后,界面默认显示全部学生的个人信息。在管理员界面中,可进行对学生个人信息、报到信息、注册信息进行查询、修改、删除等操作。
默认显示代码:

public SqlConnection lianjie()
{
     string connStr = ConfigurationManager.ConnectionStrings[0].ConnectionString;
     SqlConnection conn = new SqlConnection(connStr);
     return conn;
}

public void shuju(string sql, SqlConnection conn)
{
     SqlCommand MyCommand = new SqlCommand(sql, conn);
     SqlDataAdapter SelectAdapter = new SqlDataAdapter();
     SelectAdapter.SelectCommand = MyCommand;
     DataSet MyDataSet = new DataSet();
     SelectAdapter.SelectCommand.ExecuteNonQuery();
     SelectAdapter.Fill(MyDataSet, "Table");
     daGV.DataSource = MyDataSet.Tables["Table"]; 
     conn.Close();
}

private void 报到管理_Load(object sender, EventArgs e)
{//默认显示全部学生的信息
     SqlConnection conn = lianjie();
     conn.Open();
     string sql = "select Sno'学号',Sname'姓名',Sex'性别',Sage'出生年月',Sdept'专业',Tel'联系电话' from Student";
     shuju(sql, conn);
}

5.3.1查询
在这里插入图片描述
在这里插入图片描述
当在上方输入框输入学生学号时,可进行精准查询;若为空,则查询到对应类别的全部学生的相关信息。报到情况、注册情况类似。若该学号错误、学生没有报到或注册,则会出现错误提示。
下面给出个人信息查询代码:

SqlConnection conn = lianjie();
conn.Open();
Sno = txtId1.Text;
if (string.IsNullOrEmpty(Sno))
{
      string sql = "select Sno'学号',Sname'姓名',Sex'性别',Sage'年龄',Sdept'专业',Tel'联系电话' from Student";
      shuju(sql, conn);
      MessageBox.Show("查询到所有学生信息!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
      return;
}
string sql1 = "select Sno from Student where Sno='" + Sno + "'";
SqlCommand cmd1 = new SqlCommand(sql1, conn);
SqlDataReader reader = cmd1.ExecuteReader();
if (!reader.HasRows)
{
      MessageBox.Show("请认真核对学号是否正确!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
      return;
}
reader.Close();
sql1 = "select Sno'学号',Sname'姓名',Sex'性别',Sage'年龄',Sdept'专业',Tel'联系电话' from Student where Sno='" + Sno + "'";
shuju(sql1, conn);
conn.Close();

5.3.2修改
在这里插入图片描述在这里插入图片描述
在输入框输入要被修改信息学生的学号,个人信息修改仅可对学生的专业、联系电话、出生年月进行修改,注册情况修改是对学生的密码进行重置。
下面给出个人信息修改代码:

string connStr = ConfigurationManager.ConnectionStrings[0].ConnectionString;
SqlConnection conn = new SqlConnection(connStr);
conn.Open();
string Sno = 报到管理.Sno;
string s1 = comboBox1.Text;
string s2 = textBox1.Text;
DialogResult dia = MessageBox.Show("确实要修改 " + Sno + " 的" + s1 + "信息吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);  //修改提示
if (dia == DialogResult.Yes)  //如果确定修改
{
     string sql = String.Format("select count(*) from Student where Sno= '{0}'", Sno);  
     try
     {
           SqlCommand command = new SqlCommand(sql, conn);
           if (s1 == "专业")
                 sql = String.Format("update Student set Sdept='{0}' where Sno='{1}'", s2, Sno);  
           if (s1 == "联系电话")
                 sql = String.Format("update Student set Tel='{0}' where Sno='{1}'", s2, Sno);  
           if (s1 == "出生年月")
                 sql = String.Format("update Student set Sage='{0}' where Sno='{1}'", s2, Sno);  
           command = new SqlCommand(sql, conn);
           int count = command.ExecuteNonQuery();
           if (count > 0)
           {
                 MessageBox.Show("修改信息成功!", "修改成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.Close();
            }
            else
           {
                  MessageBox.Show("修改信息失败!", "修改失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
}
catch (Exception ex)
{//操作数据库出错情况
      MessageBox.Show(ex.Message, "操作数据库出错", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     conn.Close();
}

5.3.3报到管理(时间录入)
在这里插入图片描述
在这里插入图片描述
根据报到页面输入的学号,进行报到信息的修改,若该学生已报到则会提示“该学生已录入报到时间”,否则提示“成功录入信息”,并即时刷新其报到信息。

SqlConnection conn = lianjie();
conn.Open();
string Sno = 报到管理.Sno;
string dtpTime = dtp.Value.ToString();
SqlCommand cmd = new SqlCommand("select Sno from Baodao where Sno='"+Sno+"'", conn);
SqlDataReader reader = cmd.ExecuteReader();
if (reader.HasRows)
{
      MessageBox.Show("该学生已录入报到时间!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
      reader.Close();
      string sql1 = "select Baodao.Sno'学号',Sname'姓名',Sex'性别',CheckTime'报到时间',Pay'是否缴费',RoomNum'宿舍编号' from Baodao,Student where Baodao.Sno='" + Sno + "'and Student.Sno=Baodao.Sno";
      shuju(sql1, conn);
      return;
}
reader.Close();
string sql = "insert into Baodao(Sno,CheckTime) values('" + Sno + "','" + dtpTime + "')";
cmd = new SqlCommand(sql, conn);
int count = cmd.ExecuteNonQuery();
if (count > 0)
{
      sql = "select Baodao.Sno'学号',Sname'姓名',Sex'性别',CheckTime'报到时间',Pay'是否缴费',RoomNum'宿舍编号' from Baodao,Student where Baodao.Sno='" + Sno + "'and Student.Sno=Baodao.Sno";
      shuju(sql, conn);
      MessageBox.Show("成功录入信息!", "录入成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
      MessageBox.Show("录入信息失败!", "录入失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

5.3.4缴费管理
在这里插入图片描述
在这里插入图片描述
在修改学生的缴费情况时,询问是否确认修改,确认修改后即时刷新报到信息。

SqlConnection conn = lianjie();
conn.Open();
string Sno = 报到管理.Sno;
void Jiaofei(string s)
{
      DialogResult dia = MessageBox.Show("确定要修改" + Sno + "的缴费情况吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
      if (dia == DialogResult.Yes)
      {
            string sql = "update Baodao set Pay='" + s + "' where Sno='" + Sno + "'";
            SqlCommand cmd = new SqlCommand(sql, conn);
            int count = cmd.ExecuteNonQuery();
            if (count > 0)
            {
                 sql = "select Baodao.Sno'学号',Sname'姓名',Sex'性别',CheckTime'报到时间',Pay'是否缴费',RoomNum'宿舍编号' from Baodao,Student where Baodao.Sno='" + Sno + "'and Student.Sno=Baodao.Sno";
                 shuju(sql, conn);
                 MessageBox.Show("修改缴费信息成功!", "修改成功", MessageBoxButtons.OK, MessageBoxIcon.Information); 
             }
             else
            {
                 MessageBox.Show("修改缴费信息失败,请认真核对学号是否正确!", "修改失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        else
        {
                 MessageBox.Show("你已取消修改信息!", "取消", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
         conn.Close();
}
if (rbtnY.Checked)
{
       string s1 = "是";
       Jiaofei(s1);
}
else if (rbtnN.Checked)
{
       string s1 = "否";
       Jiaofei(s1);
}
       else
{
        MessageBox.Show("请选择缴费情况!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}

5.3.5宿舍管理
在这里插入图片描述
在这里插入图片描述
若该学生没有安排宿舍,则更新此学生报到信息中的宿舍编号这一项,并将宿舍表中对应宿舍的已住人数加1,若该宿舍人已满,则会提示“宿舍人数已满”。若该学生已安排宿舍,现需修改,询问是否确定修改,确定修改后,更新学生报到信息,同时更新宿舍表中对应信息。

SqlConnection conn = lianjie();
conn.Open();
string Num = txtRoomN.Text;//获取宿舍编号
cmd = new SqlCommand("select NumLive,AllStu from Room where RoomNum='" + Num + "'", conn);
reader1 = cmd.ExecuteReader();
if (reader1.Read())
{//宿舍人数已满
      int NumLive = Convert.ToInt32(reader1["NumLive"]);
      int AllStu = Convert.ToInt32(reader1["AllStu"]);
      if (NumLive >= AllStu)
      {
           MessageBox.Show("此宿舍人数已满!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
           return;
       }
}
reader1.Close();
DialogResult dia = MessageBox.Show("确定要修改" + 报到管理.Sno + "的宿舍编号为" + Num + "吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dia == DialogResult.Yes)
{
      cmd = new SqlCommand("select RoomNum from Baodao where Sno='" + 报到管理.Sno + "'", conn);
      reader1 = cmd.ExecuteReader();
      if (reader1.Read())
      {
           string RoomNum1 = Convert.ToString(reader1["RoomNum"]);
           reader1.Close();
           if (string.IsNullOrEmpty(RoomNum1))
           {//该学生还未安排宿舍
                  string sql = "update Baodao set RoomNum='" + Num + "' where Sno ='" + 报到管理.Sno + "'";
                  cmd = new SqlCommand(sql, conn);//更新此学生的宿舍编号
                  int count = cmd.ExecuteNonQuery();
                  if (count > 0)
                  {//宿舍已住人数加1
                       cmd = new SqlCommand("update Room set NumLive=NumLive+1 where Room.RoomNum='" + Num + "'", conn);
                       int count1 = cmd.ExecuteNonQuery();
                       if (count1 > 0)
                       {
                             string sql1 = "select Baodao.Sno'学号',Sname'姓名',Sex'性别',CheckTime'报到时间',Pay'是否缴费',RoomNum'宿舍编号' from Baodao,Student where Baodao.Sno='" + 报到管理.Sno + "'and Student.Sno=Baodao.Sno";
                              shuju(sql1, conn); 
                              MessageBox.Show("更新宿舍信息成功!", "修改成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         }
                   }
            }
            else
            {//该学生已安排宿舍,现修改
                  reader1.Close();
                  DialogResult dia1 = MessageBox.Show("该学生已安排宿舍,确定修改吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                  if (dia1 == DialogResult.Yes)
                  {
                       string sql = "update Baodao set RoomNum='" + Num + "' where Sno ='" + 报到管理.Sno + "'";
                       cmd = new SqlCommand(sql, conn);//更新此学生的宿舍编号
                       int count1 = cmd.ExecuteNonQuery();
                       if (count1 > 0)
                       {//更新学生宿舍信息成功
                            cmd = new SqlCommand("update Room set NumLive=NumLive-1 where RoomNum='" + RoomNum1 + "'", conn);
                            int count2 = cmd.ExecuteNonQuery();
                            if (count2 > 0)
                            {
                                  cmd = new SqlCommand("update Room set NumLive=NumLive+1 where RoomNum='" + Num + "'", conn);
                                  int count3 = cmd.ExecuteNonQuery();
                                  if (count3 > 0)
                                  {
                                       string sql1 = "select Baodao.Sno'学号',Sname'姓名',Sex'性别',CheckTime'报到时间',Pay'是否缴费',RoomNum'宿舍编号' from Baodao,Student where Baodao.Sno='" + 报到管理.Sno + "'and Student.Sno=Baodao.Sno";
                                       shuju(sql1, conn);
                                       MessageBox.Show("更新宿舍信息成功!", "修改成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                   }
                             }
                         }
                   }
            }
}

5.3.6删除
在这里插入图片描述
在这里插入图片描述
下面给出删除个人信息的代码:

Sno = txtId1.Text;
if (string.IsNullOrEmpty(Sno))
{
     MessageBox.Show("请输入被删除学生的学号!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     return;
}
SqlConnection conn = lianjie();
conn.Open();
void Shan(string sql)
{//删除信息
         DialogResult dia = MessageBox.Show("确定要删除" + Sno + "的学生信息吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dia == DialogResult.Yes)
         {
                SqlCommand cmd = new SqlCommand(sql, conn);
                int count = cmd.ExecuteNonQuery(); ;
                if (count > 0)
                {
                      MessageBox.Show("删除成功!", "修改成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                      MessageBox.Show("删除失败!", "修改失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                  }
          }
}
if (xinxi.Checked)
{//删除学生信息;
         SqlCommand cmd = new SqlCommand("select Sno from Stuser where Sno='" + Sno + "'", conn);
         SqlDataReader reader = cmd.ExecuteReader();
         if (reader.HasRows)
         {//学生已注册
                MessageBox.Show("该学生已注册,请先删除其注册信息!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
          }
          reader.Close();
          cmd = new SqlCommand("select Sno from Baodao where Sno='" + Sno + "'", conn);
          reader = cmd.ExecuteReader();
          if (reader.HasRows)
         {//学生已报到
                MessageBox.Show("该学生已报到,请先删除其报到信息!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
          }
          reader.Close();
          string sql = "delete from Student where Sno='" + Sno + "'";
          Shan(sql);
}

5.3.7数据统计
在这里插入图片描述
做了个小小的数据统计,大家根据自己的需求进行编写。
下面给出代码:

int Tongji(string s)
{
       SqlCommand cmd = new SqlCommand(s, conn);
       SqlDataReader reader = cmd.ExecuteReader();
       int count = 0;
       while (reader.Read())
       {
             count++;
        }
        reader.Close();
        return count;
}
string sql = "select * from Student";
int c = Tongji(sql);
txt1.Text = c.ToString();
sql = "select * from Baodao";
c = Tongji(sql);
txt2.Text = c.ToString();
sql = "select * from Baodao,Student where Sex='男' and Student.Sno=Baodao.Sno";
c = Tongji(sql);
txt3.Text = c.ToString();
sql = "select * from Baodao,Student where Sex='女' and Student.Sno=Baodao.Sno";
c = Tongji(sql);
txt4.Text = c.ToString();
sql = "select * from Baodao where Pay='是'";
c = Tongji(sql);
txt5.Text = c.ToString();
sql = "select * from Baodao where RoomNum is not null";
c = Tongji(sql);
txt6.Text = c.ToString();

5.4学生登录
在这里插入图片描述
学生登录后,页面显示学生的基本信息。下面给出代码:

string Sno = 登录.name;
string connStr = ConfigurationManager.ConnectionStrings[0].ConnectionString;
SqlConnection conn = new SqlConnection(connStr);
conn.Open();
SqlCommand cmd = new SqlCommand("select * from Student,Baodao where Student.Sno='" + Sno + "' and Baodao.Sno=Student.Sno", conn);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
        string Sname = Convert.ToString(reader["Sname"]);
        string Sex = Convert.ToString(reader["Sex"]);
        string Sage = Convert.ToString(reader["Sage"]);
        string Sdept = Convert.ToString(reader["Sdept"]);
        string Tel = Convert.ToString(reader["Tel"]);
        string CheckTime = Convert.ToString(reader["CheckTime"]);
        string Pay = Convert.ToString(reader["Pay"]);
        string RoomNum = Convert.ToString(reader["RoomNum"]);
        txt1.Text = Sno;
        txt2.Text = Sname;
        txt3.Text = Sex;
        txt4.Text = Sage;
        txt5.Text = Sdept;
        txt6.Text = CheckTime;
        txt7.Text = Pay;
        txt8.Text = RoomNum;
          textBox1.Text = Tel;
}
conn.Close();

5.4.1密码修改
在这里插入图片描述
学号须与登录学号一致,下面给出代码:

string id = 登录.name;
string sno = txtSno.Text;
string pwd1 = txtPwd1.Text;
string pwd2 = txtPwd2.Text;
string pwd3 = txtPwd3.Text;
if (id != sno)
{//登录学号与输入学号不一致
       MessageBox.Show("登录学号与输入学号不一致,请认真核对!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
       return;
}
SqlCommand cmd1 = new SqlCommand("select stuPwd from Stuser where stuPwd='" + pwd1 + "'", conn);
SqlDataReader reader1 = cmd1.ExecuteReader();
if (!reader1.HasRows)
{//原密码不正确时
        MessageBox.Show("请认真核对原密码!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
        return;
 }
reader1.Close();
if (pwd2 != pwd3)
{//密码不一致
         MessageBox.Show("密码不一致,请认真核对!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
}
SqlCommand cmd = new SqlCommand("update Stuser set stuPwd='" + pwd2 + "' where Sno='" + sno + "'", conn);
int count = cmd.ExecuteNonQuery();
if (count > 0)
{
       MessageBox.Show("密码修改成功,请返回重新登录!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
       登录 login = new 登录();
       login.ShowDialog();
       this.Close();
}
else
{
       MessageBox.Show("密码修改失败!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

链接:https://pan.baidu.com/s/1e7StyKSVbWwV5-XmovnFAw 提取码:tp6g
(上下链接一样)

以上就是此次编写新生报到管理系统的全部内容了,因为有的功能其实代码大致相同,代码量较大,所以只放了部分代码,完整代码百度网盘自取。想想自己之前不会做,找了几篇博客,但是都没有自己理想想要的,有一个很符合的,结果需要付费,哭晕,所以懂得你们的心情。
划重点,这篇博客仅适合大学生完全小白!!!!大佬就别凑热闹了?。
如果对你有用的话,可以点个赞吗?蟹蟹啦啦啦!(⌒▽⌒)

评论 29
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值