There is a datetime
input in my stored procedure.
When edmx is built with database first approach, we have a
((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("spInsert", ... , payDateParameter);
And the payDateParameter
is defined as:
var payDateParameter = payDate.HasValue ?
new ObjectParameter("PayDate", payDate.Value) :
new ObjectParameter("PayDate", typeof(System.DateTime));
where payDate
is a DateTime?
.
The exception:
The version of SQL Server in use does not support datatype 'datetime2'.
I understand there is a range limit in datatime
data type. So a minimum value is added for another try.
var payDateParameter = payDate.HasValue ?
new ObjectParameter("PayDate", payDate.Value) :
new ObjectParameter("PayDate", new DateTime(1753,1,1));
Still the same exception.
Is there a way to force stored procedure call to use my payDateParameter
as a datatime
type instead of datetime2
?