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

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
 
S

Saso Zagoranski

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
 
P

Peter Koen

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------
 
S

Saso Zagoranski

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------
 
S

Saso Zagoranski

although I just tried entering this date: 1.1.2003
this should be parsed no matter the format, right?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top