Foxtable(狐表)用户栏目专家坐堂 → 身份证 年龄 出生年月


  共有1578人关注过本帖树形打印复制链接

主题:身份证 年龄 出生年月

美女呀,离线,留言给我吧!
susu312
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:997 积分:6752 威望:0 精华:0 注册:2018/6/8 16:17:00
身份证 年龄 出生年月  发帖心情 Post By: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、可以让身份证号码输入正确后,再输入年龄和出生年月么?


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/7/27 14:24:00 [只看该作者]


 回到顶部