I have a Access DB with multiple columns,
Mark1 | Mark2 | Mark3 | Mark4 | Mark5 |
99 | 87 | 78 | 78 | 79 |
I need to get the max value and display it in a textbox
then I need to get the avg value and display it in a text box
here is my code:please help with the part as bold
- connection.Open();
- OleDbCommand command = new OleDbCommand();
- command.Connection = connection;
- string query = "select* from Students WHERE Firstname LIKE '" + tbsearchid.Text + "' OR ID1 like '" + tbsearchid.Text + "' ";
- command.CommandText = query;
-
-
- OleDbDataReader reader = command.ExecuteReader();
- while (reader.Read()) {
- tbFname.Text = reader["Firstname"].ToString();
- tbLname.Text = reader["Lastname"].ToString();
-
- string course1Text = reader["Course1"].ToString(), course2Text = reader["Course2"].ToString();
- tbmulti.Text = "Course1: " + course1Text + Environment.NewLine + "Course2: " + course2Text;
- help here >> tbhighmark.Text = max Value;
- help here >> tbCourseAvg.Text = tbCourseAvg value;
- }
- connection.Close();