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
muthukumar
NA
0
101.3k
date to int
Dec 5 2013 1:20 AM
here i write a code to convert user given dob is stored as a age in db
but it shows a error --------------
Failed to convert parameter value from a String to a Int32.
i use stored procedure for it
in .CS button _click
cmd.Parameters.Add("@age", SqlDbType.Int).Value = at.Text;
in stored procedure
@age int-----------------datatype
in table
age int
public int Age(DateTime dt)
{
DateTime today = DateTime.Today;
int age = today.Year - dt.Year;
if (dt > today.AddYears(-age))
age--;
return age;
}
protected void at_TextChanged(object sender, EventArgs e)
{
int age = Age(Convert.ToDateTime(at.Text));
Response.Write("Age:" + age);
Label8.Text = "Age" + age;
}
Reply
Answers (
2
)
modular inverse code
Printing Doesn't Print at the specified location