I don\'t want to validate txtBirthDate
so I want to pass DateTime.MinValue
in database.
My code:
if (txtBirthDate.Text == st
Simply put, don't use DateTime.MinVaue
as a default value.
There are a couple of different MinValues
out there, depending which environment you are in.
I once had a project, where I was implementing a Windows CE project, I was using the Framework's DateTime.MinValue
(year 0001), the database MinValue
(1753) and a UI control DateTimePicker
(i think it was 1970). So there were at least 3 different MinValues that were leading to strange behavior and unexpected results. (And I believe that there was even a fourth (!) version, I just do not recall where it came from.).
Use a nullable database field and change your value into a Nullable
instead. Where there is no valid value in your code, there should not be a value in the database as well. :-)