private void button2_Click(object sender, EventArgs e)
{
conn = new SqlConnection(connec.GetServer());
conn.Open();
string questas = "SELECT TOP 50 Percent * from tblStudentInformation Where GradeLevel ='" + label2.Text + "' and Result >= 85 and SectionName IS NULL";
SqlCommand dc = new SqlCommand(questas,conn);
SqlDataReader sq = dc.ExecuteReader();
sq.Close();
string que = "UPDATE tblStudentInformation SET SectionName=@sect, ShiftSched=@sched Where GradeLevel=@lb2 AND Result >= 85 AND SectionName IS NULL";
SqlCommand disc = new SqlCommand(que, conn);
disc.Parameters.AddWithValue("@lb2",label2.Text);
disc.Parameters.AddWithValue("@sect", textBox1.Text);
disc.Parameters.AddWithValue("@sched", comboBox1.SelectedItem);
SqlDataReader far = disc.ExecuteReader();
MessageBox.Show("Student Information has been Updated");
far.Close();
string ques = "UPDATE tblClass SET SectionName = @sects, ShiftSched = @scheds Where GradeLevel =@lb2s and Result >= 85 and SectionName IS NULL";
SqlCommand discs = new SqlCommand(ques, conn);
discs.Parameters.AddWithValue("@lb2s", label2.Text);
discs.Parameters.AddWithValue("@sects", textBox1.Text);
discs.Parameters.AddWithValue("@scheds", comboBox1.SelectedItem);
SqlDataReader fars = discs.ExecuteReader();
MessageBox.Show("Class has been Updated");
fars.Close();
}
>> It's just typo error :)