473,387 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

"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 25223
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Stan | last post by:
My webserver calls a component on another server through DCOM, the component goes to SQL, SQL raises the exception and here is what the client gets: "Cannot find member name...
1
by: Amir | last post by:
Hi all, I have a table called PTRANS with few columns (see create script below). I have created a view on top that this table VwTransaction (See below) I can now run this query without a...
0
by: s_gregory | last post by:
The mdb is considerable size 70 +- mb. A complex union query was working well, but when an additional union select... was added into the query, selecting identical fields from a different source,...
3
by: Karel Vandenhove | last post by:
Hi, I get an error "cannot apply indexing with to an expression of type object" when I try to compile the code below. SSLScannerManager is a COM component. (Used to access fingerprint...
0
by: rajmgopal | last post by:
Hello Everyone I am getting the following error when i try to insert a record into Sql Server 2005 from my VB 2005 application. sqlEx = {"Error converting data type numeric to numeric."} I...
3
by: Mejmeyster | last post by:
Hi Everyone, I have a table in which one of the text fields has become too small (since it only holds 255 characters). To remedy that, I'm trying to change the data type of that field to "memo"...
3
by: martin DH | last post by:
I would definitely appreciate any help with this problem as soon as possible. Thanks! I have a report that should display the results of a query based on two tables (tblClient and tblResult,...
5
AAPWM
by: AAPWM | last post by:
Hello My job is to extract data from my companies database with Crystal Reports, export that data to Excel, modify the data, save the data as "Text "tab delimited"", and upload to the database...
1
by: Ferwayne Yalung | last post by:
How can i fix the error? Private Sub cmdadd2_Click() If cmdadd2.Caption = "ADD" Then cmdadd2.Caption = "SAVE" cmdedit2.Caption = "CANCEL" buttons True, False a = Date a = Right(a, 4) ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.