I have Entity Framework ObjectContext. I need to update column of type datetime.
Here is my code:
ObjectContext.ExecuteStoreCommand(string.Format("update MyTable set DateTimeField='{0}' where Id = {1}",
myEntity.DateTimeField, IdValue));
Why am I getting such exception:
Submit operation failed. The conversion of a varchar data type to a datetime data type resulted in an out-of-range value. The Statement has been terminated.