Community discussion forum

A generic error occurred in GDI+. String was not recognized as a valid DateTime.

  • 11 months ago
    hi i am using sql server and c#.net i am trying to enter a date in the database where it is in date time format and i am using procedure where the variable is in datetime.the c# code are Hashtable rec = new Hashtable(); if (txtdob.Text.Length != 0) { rec.Add("dob", DateTime.Parse(txtdob.Text.Trim()).ToString("yyyyMMdd")); } The problem is these codes are running fine on my local pc but when i put it in the server it shows the error "A generic error occurred in GDI+. String was not recognized as a valid DateTime." what is the problem .please help.
  • 11 months ago
    Change the date time format on your server to 'yyyyMMdd' . Go to control panel-> Regional and language Options --> customize button -->date tab and then change your datetime format. It should work fine.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!