private void linklbl_productgotohome_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Admin_home home = new Admin_home(); this.Hide(); home.Show(); }
private void ll_gotohome_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Admin_home ah = new Admin_home(); this.Hide(); ah.Show(); }
private void btn_login_Click(object sender, EventArgs e) { username = txt_username.Text; u = username; password = txt_password.Text; if (username == "admin" && password == "admin") { Admin_home ah = new Admin_home(); this.Hide(); ah.Show(); } else { //sql connection SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=Product_Management;Integrated Security=true"); //to call stored procedure SqlCommand cmd = new SqlCommand("login_data", con); cmd.CommandType = CommandType.StoredProcedure; //pass the value to the stored procedure cmd.Parameters.AddWithValue("@username", username); cmd.Parameters.AddWithValue("@password", password); //execute stored procedure con.Open(); int i = (int)cmd.ExecuteScalar(); if (i > 0) { User_home uh = new User_home(); this.Hide(); uh.Show(); } else { MessageBox.Show("Invalid username & password"); } } }