473,836 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM

Alright..I've found lots of info on this error and most say assign
System.DBNull.V alue, System.Convert. DBNull, or
System.Data.Sql Types.SqlDateTi me.Null to my stored proc param and the
problem will be solved...NOT. I suspect all of these are the same
thing, however, none solve my problem. What I have is vb.net code
trying to put a null in a sql2000 datatime field. To further confuse
things, it works on my PC and not from another. I checked the DSN
being used on each machine were the same and they were. I confirmed
the SQL data type is a 'datetime' and that it is NULLable.

Code:

Dim prmBatchTsUpd As SqlParameter = new SqlParameter
prmBatchTsUpd.P arameterName = "@batch_ts"
prmBatchTsUpd.S qlDbType = SqlDbType.DateT ime
prmBatchTsUpd.S ourceColumn = "batch_ts"
sqlUpdateProCmd .Parameters.Add (prmBatchTsUpd)

prmBatchTsUpd.V alue = System.Data.Sql Types.SqlDateTi me.Null

sqlUpdateProCmd .ExecuteNonQuer y()

Stored Procedure Definition:
CREATE Procedure dbo.si_sp_XFERS ERVICE_update_x fer_profile
(
@program_name varchar(40),
@active char(1),
@batch_ts datetime
)
as

update css$steph.dbo.x fer_profile
set active = @active,
batch_ts = @batch_ts
where program_name = @program_name

Help please?

Mar 30 '06 #1
5 35247
If the same code is working on one machine and not another, then I am
guessing the other machine is going to a different database. That, or it is
running an older copy of the code or something.

<ml********@yah oo.com> wrote in message
news:11******** *************@g 10g2000cwb.goog legroups.com...
Alright..I've found lots of info on this error and most say assign
System.DBNull.V alue, System.Convert. DBNull, or
System.Data.Sql Types.SqlDateTi me.Null to my stored proc param and the
problem will be solved...NOT. I suspect all of these are the same
thing, however, none solve my problem. What I have is vb.net code
trying to put a null in a sql2000 datatime field. To further confuse
things, it works on my PC and not from another. I checked the DSN
being used on each machine were the same and they were. I confirmed
the SQL data type is a 'datetime' and that it is NULLable.

Code:

Dim prmBatchTsUpd As SqlParameter = new SqlParameter
prmBatchTsUpd.P arameterName = "@batch_ts"
prmBatchTsUpd.S qlDbType = SqlDbType.DateT ime
prmBatchTsUpd.S ourceColumn = "batch_ts"
sqlUpdateProCmd .Parameters.Add (prmBatchTsUpd)

prmBatchTsUpd.V alue = System.Data.Sql Types.SqlDateTi me.Null

sqlUpdateProCmd .ExecuteNonQuer y()

Stored Procedure Definition:
CREATE Procedure dbo.si_sp_XFERS ERVICE_update_x fer_profile
(
@program_name varchar(40),
@active char(1),
@batch_ts datetime
)
as

update css$steph.dbo.x fer_profile
set active = @active,
batch_ts = @batch_ts
where program_name = @program_name

Help please?

Mar 30 '06 #2
I do not completely understand your question.

But 32 december 2006 is not allowed, you should than use 1 january 2007.

Setting a VB dbnull.value in a SQL datetime field should not be a problem
especially not as you use parameters.

Cor
<ml********@yah oo.com> schreef in bericht
news:11******** *************@g 10g2000cwb.goog legroups.com...
Alright..I've found lots of info on this error and most say assign
System.DBNull.V alue, System.Convert. DBNull, or
System.Data.Sql Types.SqlDateTi me.Null to my stored proc param and the
problem will be solved...NOT. I suspect all of these are the same
thing, however, none solve my problem. What I have is vb.net code
trying to put a null in a sql2000 datatime field. To further confuse
things, it works on my PC and not from another. I checked the DSN
being used on each machine were the same and they were. I confirmed
the SQL data type is a 'datetime' and that it is NULLable.

Code:

Dim prmBatchTsUpd As SqlParameter = new SqlParameter
prmBatchTsUpd.P arameterName = "@batch_ts"
prmBatchTsUpd.S qlDbType = SqlDbType.DateT ime
prmBatchTsUpd.S ourceColumn = "batch_ts"
sqlUpdateProCmd .Parameters.Add (prmBatchTsUpd)

prmBatchTsUpd.V alue = System.Data.Sql Types.SqlDateTi me.Null

sqlUpdateProCmd .ExecuteNonQuer y()

Stored Procedure Definition:
CREATE Procedure dbo.si_sp_XFERS ERVICE_update_x fer_profile
(
@program_name varchar(40),
@active char(1),
@batch_ts datetime
)
as

update css$steph.dbo.x fer_profile
set active = @active,
batch_ts = @batch_ts
where program_name = @program_name

Help please?

Mar 30 '06 #3
I've confirmed, twice, that I'm running the same code and as for
pointing at a different DB, no way, the code would not even run if that
were true. My tables / stored procs are vastly different, meaning, I'm
referencing columns that do not even exist in prior environments and an
error stating so would be occurring. The 'subject' of this thread is
what's being returned as the error when attempting to pass the null.
I'm not sure where you're getting the 32 december thing...sorry if my
question is not clear.

Mar 30 '06 #4
Ok..have narrowed it down some but still now solved...its complaing
about this statement.

prmBatchTsUpd.V alue = System.Data.Sql Types.SqlDateTi me.Null

keeping in mind i've also tried :
prmBatchTsUpd.V alue = System.DBNull.V alue
prmBatchTsUpd.V alue = System.Convert. DBNull

Mar 30 '06 #5
Why don't you fire up SQL Profiler and see what is actually getting
submitted to the database.

I had this error once, but it turned out I was trying to update a
datetime column in the db with a datetime variable that had the value
DateTime.MinVal ue which is invalid for SQL Server.

Good luck

Chris

Mar 31 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7982
by: FrodoBaggins | last post by:
Dear Team, Attempting to insert a record into a SQL database, using the command: command.ExcuteNonQuery(); Get the following error message in the event log: SQLDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM
1
1383
by: poppy | last post by:
I set up my parameters in code as follows : lTTState.startDate = Today.AddDays(-10) lTTState.startDate = Today lSqlCmd.Parameters.Add(New SqlParameter("@startDate", SqlDbType.DateTime)) lSqlCmd.Parameters("@startDate").Value = lTTState.startDate lSqlCmd.Parameters.Add(New SqlParameter("@endDate", SqlDbType.DateTime)) lSqlCmd.Parameters("@endDate").Value = lTTState.endDate
1
2058
by: Paperback Writer | last post by:
I need to insert null in a DateTime field and in the ASP.Net i got this error: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. How to accomplish that ? -- Please, check my theSpoke: http://www.thespoke.net/MyBlog/dgroh/MyBlog.aspx
14
4102
by: Michael Barrido | last post by:
I have this for example: Dim iSeconds as int32 = 3600 '3600 seconds is one hour How do i convert it to "01:00:00" ? Please help. Thanks in advance!
7
5374
by: Rithish | last post by:
Hello. I noticed a strange thing while using strtotime() and date() functions in combination to generate from MySQL into a readable format. By default, the MySQL date field will be 0000-00-00 00:00:00 When I pass this to strtotime() to generate the timestamp, and then pass it to the date function, it generates 30-11-1999. <? print ( "<br> strtotime for '0000-00-00 00:00:00' : " . strtotime (
1
3950
by: lairpr | last post by:
I am having this kind of error when trying to insert a null value; SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. bellow is my code, thanks protected void btnAddTime_Click(object sender, EventArgs e) { try {
3
1772
by: baburk | last post by:
HI I want to pass null or "" When I pass like that I got an error System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. Is there is any possibility to send null or ""
4
3957
by: jhansi xavier | last post by:
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
1
2052
by: dougancil | last post by:
I have the following web page: mports System.Data.SqlClient Imports System.Data Partial Class Default2 Inherits System.Web.UI.Page Dim opnumber As String Dim exceptiondate As DateTime
0
9810
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9656
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10821
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10527
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6973
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5812
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4001
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3102
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.