M
mlafarlett
Alright..I've found lots of info on this error and most say assign
System.DBNull.Value, System.Convert.DBNull, or
System.Data.SqlTypes.SqlDateTime.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.ParameterName = "@batch_ts"
prmBatchTsUpd.SqlDbType = SqlDbType.DateTime
prmBatchTsUpd.SourceColumn = "batch_ts"
sqlUpdateProCmd.Parameters.Add(prmBatchTsUpd)
prmBatchTsUpd.Value = System.Data.SqlTypes.SqlDateTime.Null
sqlUpdateProCmd.ExecuteNonQuery()
Stored Procedure Definition:
CREATE Procedure dbo.si_sp_XFERSERVICE_update_xfer_profile
(
@program_name varchar(40),
@active char(1),
@batch_ts datetime
)
as
update css$steph.dbo.xfer_profile
set active = @active,
batch_ts = @batch_ts
where program_name = @program_name
Help please?
System.DBNull.Value, System.Convert.DBNull, or
System.Data.SqlTypes.SqlDateTime.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.ParameterName = "@batch_ts"
prmBatchTsUpd.SqlDbType = SqlDbType.DateTime
prmBatchTsUpd.SourceColumn = "batch_ts"
sqlUpdateProCmd.Parameters.Add(prmBatchTsUpd)
prmBatchTsUpd.Value = System.Data.SqlTypes.SqlDateTime.Null
sqlUpdateProCmd.ExecuteNonQuery()
Stored Procedure Definition:
CREATE Procedure dbo.si_sp_XFERSERVICE_update_xfer_profile
(
@program_name varchar(40),
@active char(1),
@batch_ts datetime
)
as
update css$steph.dbo.xfer_profile
set active = @active,
batch_ts = @batch_ts
where program_name = @program_name
Help please?