Back to directory
Problem description: Concept-related
. The MinValue and MaxValue in the DateTime structure class in. Net sometimes cause an exception, that is, the date overflow problem. The date you enter must be between January 1, and DateTime. minValue is not January 1, 1753, but January 1, 0000, and the minimum datetime value that the database can receive is 1753/1/1.. net. minValue is much smaller than it, so it has a date overflow problem.
Solve the problem
Let's perform a test:
The result is:
Therefore, if you want to query the date in the database in a program, if you want to give the date variable a default value, DateTime is not used. minValue, which is located in System. data. the SqlTypes namespace indicates the data type corresponding to SQLSERVER. The test code is as follows:
The result is:
It is embodied in the program:
??? =] = Specification = model = userManager. GetWebManageUsers (specification, PageParameters (page ?? , = PartialView (
In the code above, the DateTime type can be replaced by the SqlDateTime type because it is related to database queries!
Back to directory