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

📄 frmlfdj.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 FRMLFDJ : Form
    {
        public FRMLFDJ()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MyData mydata = new MyData();
            string s = "insert into 来访登记表(日期,来访人,来访人性别,证件号码,被访人姓名,栋号,被访人房间,来访原因,来访时间,离开时间,宿管员,备注)values("+dateTimePicker1.Text +",'"+textBox1 .Text +"','"+comboBox1 .Text+"','"+textBox5 .Text +"','"+textBox2 .Text+ "','"+textBox3 .Text+ "','"+textBox4 .Text +"','"+textBox6 .Text +"','"+maskedTextBox1 .Text +"','"+maskedTextBox2 .Text  +"','"+textBox9 .Text +"','"+textBox10 .Text +"')";
            string s1 = "select 姓名,栋号,房间号码 from 入住登记表 where 姓名='" + textBox2.Text + "' and 栋号='" + textBox3.Text + "' and 房间号码='" + textBox4.Text + "'";
           
            
            OleDbDataReader dr = mydata.getDataReader(s1);
            if (dr.HasRows == true)
            {
                if (mydata.updateSql(s))
                {
                    MessageBox.Show("登记成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; maskedTextBox1.Text  = ""; maskedTextBox2 .Text  = ""; textBox9.Text = "";
                    textBox10.Text = ""; comboBox1.Text = "";
                }
            }
            else
            {
                MessageBox.Show("被访人或房间不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            mydata.closeConnection();
        }

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

    }
}

⌨️ 快捷键说明

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