private void btnPrevious_Click(object sender, EventArgs e) { this.Hide(); subject s1 = new subject(); s1.Show(); }
private void btn_sign_in_Click(object sender, EventArgs e) { try { if (txt_username.Text.Trim() != "" && txt_password.Text.Trim() != "") { DataTable dt = new DataTable(); cmd = new SqlCommand("select user_name , user_password from user_registration where user_name=@user and user_password=@password", con); con.Open(); cmd.Parameters.AddWithValue("@user", txt_username.Text.Trim()); cmd.Parameters.AddWithValue("@password", txt_password.Text.Trim()); 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("Welcome " + txt_username.Text.Trim()); Login_info.user_name = txt_username.Text.Trim(); this.Hide(); subject s1 = new subject(); s1.Show(); } else { MessageBox.Show("Invalid User Name Or Password !! "); } } else { MessageBox.Show("Please Provide Login Details"); } } catch (Exception) { throw; } }