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 display data from Access database? C#
Aug 5 2019 10:45 PM
private
void
Bsearch_Click(
object
sender, EventArgs e)
{
try
{
connection.Open();
OleDbCommand command =
new
OleDbCommand();
command.Connection = connection;
string
query =
"select* from Students WHERE Firstname LIKE '"
+ tbsearchid.Text +
"'"
;
command.CommandText = query;
OleDbDataReader reader = command.ExecuteReader();
while
(reader.Read())
{
tbFname.Text = reader[
"Firstname"
].ToString();
tbLname.Text = reader[
"Lastname"
].ToString();
/*this part*/
tbmulti.Text = reader[(Course1: +
"Course1"
) (Course2 +
"Course2"
)].ToString();
// my access db has 10 courses colums course1 -course10
/*this part*/
tbavg.Text = reader[ provide the avg of the courses]
/*this part*/
tbmax.Text = reader[provides the max of the courses]
}
connection.Close();
}
catch
(Exception ex)
{
MessageBox.Show(
"Error "
+ ex);
}
Reply
Answers (
3
)
Memory Releasing in Desktop Application
how to select the maximum value from multiple columns c#