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
Mayank Jani
NA
477
77.5k
How to find age from Access Database in C# WindowsApplicatio
Jul 12 2017 1:06 PM
Hi all,
Greetings of the day...
I have a windows form (C#) and access database. in the database i have details of employees and there is one text field that contains date of birth. when i fetch record from the database, how can i display the age (years only. e.g. 25 Years or 35 Years) in a text box?
i have googled enough and there so many options but not the answer. please note that i want to get the answer (the age) based on date from database minus todays year.
please see the code below...
private void txtEmpNo_Validated(object sender, EventArgs e)
{
OleDbDataAdapter SearchEmp = new OleDbDataAdapter("Select EmpFullName, EmpDOB, EmpSex, EmpMobileNumber, EmpCity From Employee Where EmpIDNo='" + txtCaseNo.Text + "'", MyConn);
DataSet dsSearchEmp = new DataSet();
SearchEmp.Fill(dsSearchEmp);
if (dsSearchEmp.Tables[0].Rows.Count > 0)
{
//How to calculate? i have tryed with int, string, datetime, timespan etc.
txtEmpAge.text = //What code?
}
}
please help.
thank you
Mayank Jani
Reply
Answers (
9
)
PayPal recurring payments using DLL Using MVC(C#)
Write Only Property