Click here to Skip to main content
16,004,836 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Greeting people...i develop a web..everything working fine till deployment...my question is..why is it this error appear? because if i run the web on Visual Studio Server everything fine...but when i deploy and run it on IIS server suddenly this error appear...why is people?? really need some help here..the stack trace point at this line...

C#
Line 111: string date = Convert.ToDateTime(txtdate.Text).ToString("yyyy-MM-dd");
Posted
Updated 22-Apr-12 8:11am
v2
Comments
hitech_s 23-Apr-12 0:31am    
can u please check once whether txtdate.Text contains data or not ?

1 solution

Better way to do it is to use DateTime.TryParse. Refer to the following link:
http://msdn.microsoft.com/en-us/library/system.datetime.tryparse.aspx[^]

Alternatively, you can use DateTime.TryParseExact :
http://msdn.microsoft.com/en-us/library/ms131044.aspx[^].
 
Share this answer
 
Comments
beh7606 22-Apr-12 14:32pm    
if my conversion fail, then why is it running succesfully on Visual Studio Server..? the issue here is, why not on IIS? is it something to do with my code?

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