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

📄 frmadddep.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 PMS.PMSClass;
namespace PMS
{
    public partial class frmAddDep : Form
    {
        public frmAddDep()
        {
            InitializeComponent();
        }
        DBOperate operate = new DBOperate();
        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (txtDepName.Text.Trim() == "")
            {
                MessageBox.Show("请输入部门名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                string str="select count(*) from tb_department where DepName='"+txtDepName.Text.Trim()+"'";
                int i=operate.HumanNum(str);
                if (i > 0)
                {
                    MessageBox.Show("该部门已经存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    string Addsql = "insert into tb_department(DepName) values('" + txtDepName.Text.Trim() + "')";
                    if (operate.OperateData(Addsql) > 0)
                    {
                        MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }

        private void frmAddDep_Load(object sender, EventArgs e)
        {

        }
    }
}

⌨️ 快捷键说明

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