G
Guest
I have a stored procedure that has a couple of DateTime parameters that are
used to update nullable DateTime columns in one of my tables. When I call
the stored procedure using ADO.NET in C# from an OdbcCommand object and
attempt to set the DateTime parameters to null, I am getting the following
exception message: "String was not recognized as a valid DateTime."
The calling code for the parameters in question has the following form:
parm = command.Parameters.Add("@myDate", OdbcType.DateTime);
parm.Direction = ParameterDirection.Input;
parm.Value = DBNull.Value;
The exception occurs when executing command.ExecuteNonQuery(), A display of
the exception stacktrace shows that the exception is thrown within the Parse
method of the System.DateTimeParse class before a call is made to the stored
procedure. Can anyone give me some guidance as to why the system is trying
to perform a parse on a field that has been set to the DBNull.Value?
Thanks in advance for any assistance you can provide.
Wilker Shane Bruce, Ph.D.
used to update nullable DateTime columns in one of my tables. When I call
the stored procedure using ADO.NET in C# from an OdbcCommand object and
attempt to set the DateTime parameters to null, I am getting the following
exception message: "String was not recognized as a valid DateTime."
The calling code for the parameters in question has the following form:
parm = command.Parameters.Add("@myDate", OdbcType.DateTime);
parm.Direction = ParameterDirection.Input;
parm.Value = DBNull.Value;
The exception occurs when executing command.ExecuteNonQuery(), A display of
the exception stacktrace shows that the exception is thrown within the Parse
method of the System.DateTimeParse class before a call is made to the stored
procedure. Can anyone give me some guidance as to why the system is trying
to perform a parse on a field that has been set to the DBNull.Value?
Thanks in advance for any assistance you can provide.
Wilker Shane Bruce, Ph.D.