TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
J Vs
1.7k
52
3k
how to select the maximum value from multiple columns c#
Aug 6 2019 1:31 AM
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();
Reply
Answers (
12
)
How to display data from Access database? C#
TreeView - detect node position change