469,327 Members | 1,206 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,327 developers. It's quick & easy.

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

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

Nov 15 '05 #1
4 25028
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" <sa*************@guest.arnes.si> wrote in message
news:bp**********@planja.arnes.si... 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

Nov 15 '05 #2
"Saso Zagoranski" <sa*************@guest.arnes.si> wrote in news:bp85pd$93l
$1@planja.arnes.si:
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...


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------
Nov 15 '05 #3
how can I check, which format I'm using?

saso

"Peter Koen" <koen-newsreply&snusnu.at> wrote in message
news:uH**************@TK2MSFTNGP11.phx.gbl...
"Saso Zagoranski" <sa*************@guest.arnes.si> wrote in news:bp85pd$93l $1@planja.arnes.si:
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...


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

Nov 15 '05 #4
although I just tried entering this date: 1.1.2003
this should be parsed no matter the format, right?

"Saso Zagoranski" <sa*************@guest.arnes.si> wrote in message
news:bp**********@planja.arnes.si...
how can I check, which format I'm using?

saso

"Peter Koen" <koen-newsreply&snusnu.at> wrote in message
news:uH**************@TK2MSFTNGP11.phx.gbl...
"Saso Zagoranski" <sa*************@guest.arnes.si> wrote in

news:bp85pd$93l
$1@planja.arnes.si:
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...


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


Nov 15 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.