コード例 #1
0
        private void bt_Login_Click(object sender, EventArgs e)
        {
            cmd = new Sqlcommands();
            if (KiemTraThongTin())
            {
                //con.Open();
                //{
                //    c = new SqlCommand("DANGNHAPHETHONG", con);


                //    c.CommandType = CommandType.StoredProcedure;
                //    c.Parameters.Add(new SqlParameter("@id", SqlDbType.Int)).Value = txtTaoKhoanDangNhap.Text;
                //    c.Parameters.Add(new SqlParameter("@mk", SqlDbType.NVarChar)).Value = txtMKDangNhap.Text;
                //    int tmp=Int32.Parse(c.ExecuteScalar().ToString());
                if (cmd.open())
                {
                    string[] thamso = { "id", "mk" };
                    string[] giatri = { txtTaoKhoanDangNhap.Text, txtMKDangNhap.Text };
                    object   tmp    = cmd.getObjectStoredProcedure(thamso, giatri, "DANGNHAPHETHONG");
                    int      check  = Int32.Parse(tmp.ToString());
                    if (check == 1)
                    {
                        MessageBox.Show("Đăng Nhập Thành Công");
                        frmTrangChu f = new frmTrangChu(); f.Show();
                    }
                    else
                    {
                        MessageBox.Show("Đăng Nhập Thất Bại");
                    }
                }
            }
            else
            {
                MessageBox.Show("Thông Tin Chưa Đầy Đủ");
            }
            con.Close();
        }