Using EntityFramework v4.1 and IBM Data Server Client v9.7fp5
, DB first generated code based on a pre-defined DB2 table which has DATE columns. The DB2 DATE columns are mapped to .NET DateTime data types during the code generation.
When attempting to INSERT
a row, receive the following error
ERROR [22008] [IBM] CLI0114E Datetime field overflow. SQLSTATE=22008
which makes sense, since .NET does not have a DATE data type, just DATETIME and that attribute would have more data then the DB2 DATE column would expect.
The questions are
why doesn't the .NET base code automatically convert using ToShortDateString() and provide DB2 what it is expecting?
what approaches could be used to override the .NET base logic and convert the value within application code before .NET submits the SQL transaction to DB2?
Any assistance or feedback would be appreciated. Thanks!