private void roomToolStripMenuItem_Click(object sender, EventArgs e) { Form_Room a = new Form_Room(); this.Hide(); a.ShowDialog(); this.Show(); }
private void btn_login_Click(object sender, EventArgs e) { byte[] temp = ASCIIEncoding.ASCII.GetBytes(txt_password.Text); byte[] hasData = new MD5CryptoServiceProvider().ComputeHash(temp); string hasPass = ""; foreach (byte item in hasData) { hasPass += item; } try { conn.Open(); command = conn.CreateCommand(); command.CommandText = "Select* from Account where UserName = '******' " + "and Password = '******'"; SqlDataReader dta = command.ExecuteReader(); if (dta.Read() == true) { Form_Room a = new Form_Room(); this.Hide(); a.ShowDialog(); this.Show(); } else { MessageBox.Show("Đăng nhập thất bại !"); } conn.Close(); } catch (Exception) { MessageBox.Show("Lỗi đăng nhập!"); } }