C
Chris
I'm trying to insert a null date into a nullable sql2000 datetime column,
but i'm getting this error:
An unhandled exception of type 'System.Data.SqlTypes.SqlTypeException'
occurred in system.data.dll
Additional information: SqlDateTime overflow. Must be between 1/1/1753
12:00:00 AM and 12/31/9999 11:59:59 PM.
See code below.
Any help is greatly appreciated!
Chris
-------START----------------------
Imports System.Data.SqlClient
MyFct(ByVal SomeDate As DateTime)
...
cmd.CommandText = "MyStoredProc"
cmd.Parameters.Add(New SqlParameter("@SomeDate", SqlDbType.DateTime, 8))
'IsDBNull(SomeDate) is True at this point (aka, #12:00:00 AM#).
cmd.Parameters("@SomeDate").Value = SomeDate
cn.Open()
cmd.ExecuteNonQuery() 'This line gives error (above).
end function
-----------------------------
SQL Server 2000 Stored Proc:
CREATE PROCEDURE MyStoredProc
@SomeDate datetime
AS
INSERT INTO MyTable (
SomeDate
)
VALUES (
@SomeDate
)
-----------------------------
SQL Server 2000 Partial Tbl Def:
CREATE TABLE [MyTable] (
....
[SomeDate] [datetime] NULL
)
-----------END------------------
but i'm getting this error:
An unhandled exception of type 'System.Data.SqlTypes.SqlTypeException'
occurred in system.data.dll
Additional information: SqlDateTime overflow. Must be between 1/1/1753
12:00:00 AM and 12/31/9999 11:59:59 PM.
See code below.
Any help is greatly appreciated!
Chris
-------START----------------------
Imports System.Data.SqlClient
MyFct(ByVal SomeDate As DateTime)
...
cmd.CommandText = "MyStoredProc"
cmd.Parameters.Add(New SqlParameter("@SomeDate", SqlDbType.DateTime, 8))
'IsDBNull(SomeDate) is True at this point (aka, #12:00:00 AM#).
cmd.Parameters("@SomeDate").Value = SomeDate
cn.Open()
cmd.ExecuteNonQuery() 'This line gives error (above).
end function
-----------------------------
SQL Server 2000 Stored Proc:
CREATE PROCEDURE MyStoredProc
@SomeDate datetime
AS
INSERT INTO MyTable (
SomeDate
)
VALUES (
@SomeDate
)
-----------------------------
SQL Server 2000 Partial Tbl Def:
CREATE TABLE [MyTable] (
....
[SomeDate] [datetime] NULL
)
-----------END------------------