Exemplo n.º 1
0
        private void Login_btn_submit_Click(object sender, EventArgs e)
        {
            DB      db = new DB();
            DataRow dr = null;

            userID  = Login_tb_userId.Text;
            userPwd = Login_tb_userPwd.Text;
            string sqlStr = "select user_id,user_pwd from Z_USER where user_id='" + userID + "' and user_pwd='" + userPwd + "'";

            dr = db.GetDataRow(sqlStr);
            Console.Write(dr);
            if (dr == null)
            {
                MessageBox.Show("用户名或者密码错误!");
                Login_tb_userId.Text  = "";
                Login_tb_userPwd.Text = "";
                Login_tb_userId.Focus();
            }
            else
            {
                if (userID == "admin")
                {
                    Main main = new Main();
                    main.Show();
                    this.Hide();
                }
                else
                {
                    Main2 main2 = new Main2();
                    main2.Show();
                    this.Hide();
                }
            }
        }
Exemplo n.º 2
0
 private void Login_btn_reset_Click(object sender, EventArgs e)
 {
     Login_tb_userId.Text  = "";
     Login_tb_userPwd.Text = "";
     Login_tb_userId.Focus();
 }