2
Answers

Conversion failed when converting date and/or time from character string

Kalpana Lande

Kalpana Lande

7y
257
1
Hi , I am new in programming I got the above error in my project. how to solve this? error thanks in advance
Answers (2)
0
Rafnas T P
NA 12.2k 435.7k 7y
I think you are try to convert a string which is not a proper date format thats why you are getting error in sql server, so before sending to sql please convert to datetime formate
0
Sundar
NA 9.6k 94.5k 7y
Convert the Textbox to DateTime. Its because of convertion. C# accepts all as Strings. when you enter date, you have to convert it
 
DateTime.ParseExact(Textbox1.Text.Trim(), "dd/MM/yyyy", null).ToString("MM/dd/yyyy");