I want to check the value of System.DateTime before adding it as a parameter to my SqlCommand instance.
The MSDN documentation for the SqlDbType enumeration states:
Date and time data from January 1, 1753 to December 31, 9999, accurate to 3.33 milliseconds.
To check the value, I use
public readonly DateTime SqlDateTimeMin = new DateTime(1753, 1, 1); public readonly DateTime SqlDateTimeMax = new DateTime(9999, 12, 31); if (value < SqlDateTimeMin || value > SqlDateTimeMax)
Is this the best way? Is there an alternative to hard coding these minimum and maximum values?
Ed i
source share