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();


Rajanikant HawaldarRank #110 · 20.2K reputationPosted Aug 6, 2019, 11:40 PM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Aug 5, 2019, 11:17 PM EDT
J Vs56 reputationPosted Aug 6, 2019, 9:43 PM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Aug 5, 2019, 10:13 PM EDT
J Vs56 reputationPosted Aug 5, 2019, 10:18 PM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Aug 5, 2019, 10:30 PM EDT
J Vs56 reputationPosted Aug 5, 2019, 10:45 PM EDT
J Vs56 reputationPosted Aug 6, 2019, 8:18 PM EDT
Amit MohantyRank #112 · 20K reputationPosted Aug 6, 2019, 9:35 PM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Aug 6, 2019, 10:11 PM EDT
J Vs56 reputationPosted Aug 6, 2019, 10:20 PM EDT
Amit MohantyRank #112 · 20K reputationPosted Aug 6, 2019, 12:25 AM EDT