以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  身份证 年龄 出生年月  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=122530)

--  作者:susu312
--  发布时间:2018/7/27 14:19:00
--  身份证 年龄 出生年月

 

表的datachanged事件:

Select Case e.DataCol.Name
    Case "cardID"
        If e.DataRow.IsNull("cardID") Then  \'身份证号码是否为空
            e.DataRow("birth") = Nothing  \'如果为空,则清除出生日期
            e.DataRow("age") = Nothing \'如果为空,则清除年龄
        Else
            \'否则从身份证号码列中提取出生日期
            e.DataRow("birth") = ReadBirthday(e.DataRow("cardID"))
            Dim d As Date = ReadBirthday(e.DataRow("cardID"))
            Dim y As Integer = d.year
            If format(d, "MMdd") <= Format(Date.Today, "MMdd") Then
                e.DataRow("age") = Date.Today.Year - y
            Else
                e.DataRow("age") = Date.Today.Year - y -1
            End If
        End If

   Case "partyTime"
        If e.DataRow.IsNull("partyTime") Then  \'入党时间是否为空
           e.DataRow("partyStanding") = Nothing  \'如果为空,则清除出生日期
        Else
            Dim d As Date = e.DataRow("partyTime")
            Dim y As Integer = d.year
            If format(d, "MMdd") <= Format(Date.Today, "MMdd") Then
                e.DataRow("partyStanding") = Date.Today.Year - y
            Else
                e.DataRow("partyStanding") = Date.Today.Year - y -1
            End If

         End If
End Select

 

 


图片点击可在新窗口打开查看此主题相关图片如下:2.png
图片点击可在新窗口打开查看

老师, 在上图中,我身份证号码并没有输入正确,年龄就显示2017,这显然是错误的,不知咋么算出2017的。

 

1、可以让身份证号码输入正确后,再输入年龄和出生年月么?


--  作者:有点甜
--  发布时间:2018/7/27 14:24:00
--  

ValidPIN验证一下身份证

 

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=118957&skin=0

 

http://www.foxtable.com/webhelp/scr/2624.htm