Author: shagil.a.gopinath | Posted on: 12/18/2008 3:57:27 AM | Views : 287

I am getting error Year, Month, and Day parameters describe an un-representable DateTime. While inserting date to sql server.

1) First time I was using the DateTime.Now function to insert the date to Database but after getting the error I have changed the date format When the date format is in the form ?18/12/2008 12:00:00 AM?

Error - The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value ?

2) I have changed the date format to MM/DD/YY

string[] Date = new string[2];

Int32 date, month, year = 0;

DateTime InterDate;

Date = DateTime.Now.Date.ToShortDateString().Split('/');

date = Convert.ToInt16(Date[1]);

month = Convert.ToInt16(Date[0]);

year = Convert.ToInt16(Date[2]);

InterDate = new DateTime(Convert.ToInt16(Date[2]), Convert.ToInt16(Date[0]), Convert.ToInt16(Date[1]));

Now the date format is ?12/18/2008 12:00:00 AM? But am gettin ...

Go to the complete details ...