 public addUsercs()
        {
            InitializeComponent();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtName.Text == "" || txtPwd.Text == "" || txtPwdSure.Text == "")
            {
                MessageBox.Show("벻");
            }
            else
            {
                SqlConnection con = new SqlConnection(dormConn.connection);
                SqlCommand cmd = new SqlCommand("", con);
                con.Open();
                if (txtPwd.Text.Trim() == txtPwdSure.Text.Trim())
                {
                    User user = new User(txtName.Text, txtPwd.Text, txtType.Text);
                    cmd.CommandText = user.Add(user); //öķ
                    cmd.ExecuteNonQuery();
                    txtName.Text = "";//սıݣһ
                    txtPwd.Text = "";
                    txtPwdSure.Text = "";
                    txtName.Focus();
                    userRefresh();
                    MessageBox.Show("ݳɹ");
                }
                else
                {
                    MessageBox.Show("벻һ", "ʾ");
                }
                con.Close();
            }
        }

        private void addUsercs_Load(object sender, EventArgs e)
        {
            userRefresh();
        }

        private void userRefresh()
        {
            SqlConnection con = new SqlConnection(dormConn.connection);//ӵݿ
            SqlDataAdapter da = new SqlDataAdapter("select * from U_userinfor", con);//ͨӲݿѯ
            con.Open();
            DataSet ds = new DataSet();
            da.Fill(ds, "user");
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource = ds.Tables["user"];
            con.Close();
        }

        private void btnCancle_Click(object sender, EventArgs e)
        {
            this.Dispose();//رԼ˳ڴ
            this.Hide();//Լ
        }

        private void btnDelet_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(dormConn.connection);//ӵݿ
            SqlCommand cmd = new SqlCommand("", con);
            cmd.CommandText = "delete from U_userinfor where U_UserName='"+dataGridView1.SelectedRows[0].Cells[0].Value.ToString()+"'";
            con.Open();
            cmd.ExecuteNonQuery();
            userRefresh();//ˢݱĿؼ
            con.Close();
        }