DateTime.MaxValue overflow error in SQL Server CE

The following lines of code should pass the maximum date¬† that can be selected¬†to a SQL statement via a parameter. SqlCeCommand insertCommand = dbConn.CreateCommand();insertCommand.CommandType = CommandType.Text;insertCommand.CommandText = “INSERT INTO MyDateTable (DateField) Values (@MyDate)”; insertCommand.Parameters.Add(new SqlCeParameter(“MyDate”, SqlDbType.DateTime)); insertCommand.Parameters[“MyDate”].Value = DateTime.MaxValueinsertCommand.ExecuteNonQuery(); This works fine on all desktop versions of SQL Server, but on SQL Server CE on …

DateTime.MaxValue overflow error in SQL Server CE Read More »