private void pictureBox1_Click(object sender, EventArgs e) { Mainpage main = new Mainpage(); this.Hide(); main.Show(); }
private void Btn_Login_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(); con.ConnectionString = "Data Source=DESKTOP-O8UDH05;Initial Catalog=APRO;Integrated Security=True"; con.Open(); string UserName = tb_Username.Text; string Password = tb_password.Text; SqlCommand cmd = new SqlCommand("select UserName,Password from Reg where UserName='******'and Password='******'", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { MessageBox.Show("Login sucess Welcome to AA Production"); Mainpage m = new Mainpage(); this.Hide(); m.Show(); } else { Wrong_password_alert wrong = new Wrong_password_alert(); wrong.Show(); } con.Close(); }