private void pictureBox2_Click(object sender, EventArgs e) { this.Hide(); ManagerDB db = new ManagerDB(); db.Show(); }
private void mLogin_Click(object sender, EventArgs e) { try { SqlConnection con = new SqlConnection(); con.ConnectionString = "data source = AIRONY-LAPTOP;database = GymManagementSystem;integrated security = SSPI"; SqlCommand cmd = new SqlCommand( cmdText: "Select * from manageinfo where username='******'and password='******'", connection: con); con.Open(); SqlDataAdapter adapt = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); adapt.Fill(ds); con.Close(); int count = ds.Tables[0].Rows.Count; if (count == 1) { MessageBox.Show("Login Successful!"); this.Hide(); ManagerDB em = new ManagerDB(); em.Show(); } else { MessageBox.Show("Login Failed!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }