I have a windows application working with a SQL Compact 4.0 database, using EF 4.1 and code-first approach. I cannot save an object to the database since I'm getting an exception, with inner exception "An overflow occurred while converting to datetime" when trying to save the type Quotation:
public class Quotation
{
public int ID { get; set; }
public string Name { get; set; }
public DateTime DateCreated { get; set; }
public ContactPerson ContactPersonAssigned { get; set; }
public string OurReference { get; set; }
public string QuotationDataString { get; set; }
}
I read that this error can be caused by a mismatch between my application settings and the sql compact database settings regarding the conversion of a date. I'm not sure about it, since my sdf database file has a field which is correctly named "DateCreated", not-nullable and of type "datetime".
I'm new to SQL compact. Could you help me debug this problem?
See Question&Answers more detail:os