private void loginbutton_Click_1(object sender, EventArgs e) { string user = username.Text; string pass = passwd.Text; SqlConnection connection = new SqlConnection("Data Source=HCP\\SQLEXPRESS;Initial Catalog=ecommercedb;Integrated Security=True"); connection.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = connection; cmd.CommandText = "SELECT * FROM Admin_ where username='******' AND password='******'"; Console.WriteLine(cmd.CommandText); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { AdminPanel admin = new AdminPanel(); admin.Show(); this.Hide(); } else { MessageBox.Show("Check your username and password."); } connection.Close(); /* AdminPanel adminpanel = new AdminPanel(); * adminpanel.Show(); * * this.Hide();*/ }
private void button1_Click(object sender, EventArgs e) { AdminPanel adminpanel = new AdminPanel(); adminpanel.Show(); this.Hide(); }