private void button1_Click(object sender, EventArgs e) { connect.Open(); String query = "UPDATE Courses SET " + textBox1.Text + " = 'Course Deleted!' WHERE StudentId= '" + textBox2.Text + "'"; SqlCommand command = new SqlCommand(query, connect); command.ExecuteNonQuery(); MessageBox.Show("Course Removed!"); DashBoard dash = new DashBoard(); dash.Show(); this.Hide(); connect.Close(); }
private void button1_Click(object sender, EventArgs e) { connect.Open(); String query = "INSERT INTO Courses(StudentId,Course1,Course2,Course3,Course4,Course5,Course6)VALUES('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "')"; SqlCommand command = new SqlCommand(query, connect); command.ExecuteNonQuery(); MessageBox.Show("Course Registration Completed!"); DashBoard dash = new DashBoard(); dash.Show(); this.Hide(); connect.Close(); }