⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmwjdj.cs

📁 学生宿舍管理系统 学生宿舍管理系统
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb ;
namespace 学生宿舍管理系统
{
    public partial class FrmWJDJ : Form
    {
        public FrmWJDJ()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show("请输入学号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox1.Focus(); return;
            }
            if (textBox2.Text == "")
            {
                MessageBox.Show("请输入姓名!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox2.Focus(); return;
            }
            if (textBox3.Text == "")
            {
                MessageBox.Show("请输入栋号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox3.Focus(); return;
            }
            if (textBox4.Text == "")
            {
                MessageBox.Show("请输入房间号码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox4.Focus(); return;
            }
            if (textBox5.Text == "")
            {
                MessageBox.Show("请输入院系!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox5.Focus(); return;
            }
            if (textBox6.Text == "")
            {
                MessageBox.Show("请输入班级!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox6.Focus(); return;
            }
            if (textBox7.Text == "")
            {
                MessageBox.Show("请输入违纪行为!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox7.Focus(); return;
            }
            if (textBox8.Text == "")
            {
                MessageBox.Show("请输入处理结果!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox8.Focus(); return;
            }
            if (textBox9.Text == "")
            {
                MessageBox.Show("请输入宿管员名字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox9.Focus(); return;
            }

            string s1 = "select * from 入住登记表 where 学号='" + textBox1.Text + "' and 姓名='" + textBox2.Text + "'";
            string s2 = "insert into 违章登记表 (学号,姓名,栋号,房间号码,院系,班级,违纪时间,违纪行为,处理结果,宿管员)values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text.ToString() + "','" + textBox5.Text + "','" + textBox6.Text + "','"+dateTimePicker1 .Text +"','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "')";
            MyData mydata = new MyData();
            DataSet ds = mydata.getDataSet(s1, "入住登记表");
            if (ds.Tables["入住登记表"].Rows.Count != 0)
            {
                if (mydata.updateSql(s2))
                { 
                    MessageBox.Show("登记成功!","提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; textBox7.Text = ""; textBox8.Text = ""; textBox9.Text = "";
                }
            }
            else
            {
                MessageBox.Show("不存在此学生!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; textBox7.Text = ""; textBox8.Text = ""; textBox9.Text = "";
            }
            mydata.closeConnection();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -