Click here to Skip to main content
15,902,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi.
i have made a calender with jquery and put it in my form so when user click on textbox the calendar appeares and can choose his (her) birthdate,
but my problem is :
sometimes when i do this and want to insert into the database this exception occures :

String was not recognized as a valid DateTime.

meanwhile this exception in some part of time happens. i don't know how can i prevent it happens?
Posted

1 solution

Don't pass it as a string.

Pass it as a DateTime variable instead, via a Parametrised query.

I can't give you code, as I have no idea what code you are currently using...
 
Share this answer
 
Comments
mohammad ehsan 22-Sep-12 5:39am    
the datatype which i have used is Date in Sqlserver .
do you think that my it refers to my calendar?
OriginalGriff 22-Sep-12 5:42am    
No, what it means is that you are handing it over as a string, and it doesn't understand the format of the string you gave it. Give it a DateTime variable instead via a parametrised query rather than a string at all!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900