Hi I am getting this error:
Writing record number:
60479System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
I have tried this :
try
{
DateTime dt = Convert.ToDateTime(fireBirdReader["DUEDATE"]);
cmd.Parameters.AddWithValue("@DUEDATE", fireBirdReader["DUEDATE"]);
}
catch
{
cmd.Parameters.AddWithValue("@DUEDATE", DateTime.Now);
}
Also I have tries this:
DateTime temp;
if(DateTime.TryParse(startDateTextBox.Text, out temp))
{
cmd.Parameters.AddWithValue("@DUEDATE", temp);
}
else
{
cmd.Parameters.AddWithValue("@DUEDATE", DateTime.Now);
}
But none of them working. I am using c# and console application.
Why you are marking as duplicate that answer is not working in my case. Can you please test it yourself. Do not try to over smart before try. I can also search google and stackoverflow.