Im using DataAnnotations in an interface of a linq sql class. Thats all fine.
与时段有关的问题
我的法典如下:
[DataType(DataType.Date)]
[RegularExpression(@"^([1-9]|0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)dd$", ErrorMessage = "regexFail")]
DateTime? DateofBirth { get; set; }
Now the datatype expression works fine, it brings in a date rather than a date time. The problem lies in validation of the fields. My regex doesn t match dates, even though i put it into an engine and it does. For instance i put "10/10/2010" in the field and i get the error "regexFail".
我确信我的发言是好的,因此我不敢肯定什么错了。
Thanks in advance.