//Open ViewAll Form private void button1_Click(object sender, EventArgs e) { this.Hide(); ViewAll fm = new ViewAll(); fm.Show(); }
private void button1_Click(object sender, EventArgs e) { i = 0; con.Open(); MySqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "SELECT * FROM admin where username ='******' and password='******'"; cmd.ExecuteNonQuery(); DataTable dt = new DataTable(); MySqlDataAdapter da = new MySqlDataAdapter(cmd); da.Fill(dt); i = Convert.ToInt32(dt.Rows.Count.ToString()); if (i != 0) { this.Hide(); ViewAll fm = new ViewAll(); fm.Show(); } else { MessageBox.Show("Invalid Email or password"); textBox1.Text = ""; textBox2.Text = ""; } con.Close(); }