private void AvailableBtn_Click(object sender, EventArgs e) { this.Hide(); AvailableForT UG = new AvailableForT(uid); UG.Show(); }
private void SubmitBtn_Click(object sender, EventArgs e) { con = new SqlConnection(@"data source= rafi\SqlExpress;" + "database= Course;" + "integrated security= SSPI"); con.Open(); int a = 0; if (checkBox1.Checked) { cmd = new SqlCommand("Insert into preference(pretid, precid) values (@name, @gen)", con); cmd.Parameters.AddWithValue("@name", i); cmd.Parameters.AddWithValue("@gen", "CSE101"); cmd.ExecuteNonQuery(); a = 1; } if (checkBox2.Checked) { cmd = new SqlCommand("Insert into preference(pretid, precid) values (@name, @gen)", con); cmd.Parameters.AddWithValue("@name", i); cmd.Parameters.AddWithValue("@gen", "CSE102"); cmd.ExecuteNonQuery(); a = 1; } if (checkBox2.Checked) { cmd = new SqlCommand("Insert into preference(pretid, precid) values (@name, @gen)", con); cmd.Parameters.AddWithValue("@name", i); cmd.Parameters.AddWithValue("@gen", "CSE103"); cmd.ExecuteNonQuery(); a = 1; } if (a == 1) { MessageBox.Show("Submitted!"); this.Hide(); AvailableForT add = new AvailableForT(id); add.Show(); } }