"Arithmetic overflow error converting expression to data type datetime" error

  • Thread starter Thread starter Saso Zagoranski
  • Start date Start date
S

Saso Zagoranski

Hi!

I have created an SqlCommand object and I have set some parameters to it...
One of the parameters is of the DateTime type;

here is the code:
sqlCommand.Parameters[0].Value = DateTime.Parse(this.DateTextBox.Text);
sqlCommand.ExecuteNonReader();

I get the error:
Arithmetic overflow error converting expression to data type datetime

thanks,
saso
 
Hi!
What is in this.DataTextBox.Text

DateTextBox is just a TextBox where the user enters a date (dd/mm/yy)...
the same thing happens if I enter DateTime.Now insted... I still get the
same error...


Saso Zagoranski said:
Hi!

I have created an SqlCommand object and I have set some parameters to it...
One of the parameters is of the DateTime type;

here is the code:
sqlCommand.Parameters[0].Value = DateTime.Parse(this.DateTextBox.Text);
sqlCommand.ExecuteNonReader();

I get the error:
Arithmetic overflow error converting expression to data type datetime

thanks,
saso
 
Hi!


DateTextBox is just a TextBox where the user enters a date (dd/mm/yy)...
the same thing happens if I enter DateTime.Now insted... I still get the
same error...

And you are sure you aren't using us-time format? (mm/dd/yyyy)

this error usualy happens if you are entering dates with the wrong
formating.

greets
Peter

--
------ooo---OOO---ooo------

Peter Koen - www.kema.at
MCAD CAI/RS CASE/RS IAT

------ooo---OOO---ooo------
 
how can I check, which format I'm using?

saso

Peter Koen said:
And you are sure you aren't using us-time format? (mm/dd/yyyy)

this error usualy happens if you are entering dates with the wrong
formating.

greets
Peter

--
------ooo---OOO---ooo------

Peter Koen - www.kema.at
MCAD CAI/RS CASE/RS IAT

------ooo---OOO---ooo------
 
although I just tried entering this date: 1.1.2003
this should be parsed no matter the format, right?
 
Back
Top