以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  请教如何判断输入的身份证号码是否准确?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=90649)

--  作者:nbsfy
--  发布时间:2016/9/19 9:50:00
--  请教如何判断输入的身份证号码是否准确?
请教如何判断输入的身份证号码是否准确?
--  作者:有点蓝
--  发布时间:2016/9/19 11:01:00
--  
参考:http://www.foxtable.com/webhelp/scr/2624.htm
--  作者:nbsfy
--  发布时间:2016/9/19 11:34:00
--  请教这个代码那个地方出错了?
If e.DataCol.Name = "身份证号码"  Then \'是身份证号码发生变化吗?
    If e.DataRow.IsNull("身份证号码") Then \'身份证号码是否为空
        e.DataRow("出生日期") = Nothing \'如果为空,则清除出生日期
        e.DataRow("性别") = Nothing \'如果为空,则清除性别期
    Else
       If  ValidPIN("身份证号码")  Then \'判断身份证号码是否准确
           e.DataRow("出生日期") = ReadBirthday(e.DataRow("身份证号码" ))
           e.DataRow("性别") = ReadSex(e.DataRow("身份证号码" ))
       Else
          MessageBox.show("对不起,该身份证号码无法通过验证,请检查!","系统提示",MessageBoxButtons.OK, MessageBoxIcon.Information)
       End If
    End If
End If




--  作者:nbsfy
--  发布时间:2016/9/19 11:55:00
--  这样可以吗?
If e.DataCol.Name = "身份证号码"  Then \'是身份证号码发生变化吗?
    If e.DataRow.IsNull("身份证号码") Then \'身份证号码是否为空
        e.DataRow("出生日期") = Nothing \'如果为空,则清除出生日期
        e.DataRow("性别") = Nothing \'如果为空,则清除性别期
    Else
          If  ValidPIN(e.DataRow("身份证号码"))  Then \'判断身份证号码是否准确
           e.DataRow("出生日期") = ReadBirthday(e.DataRow("身份证号码" ))
           e.DataRow("性别") = ReadSex(e.DataRow("身份证号码" ))
       Else
          MessageBox.show("对不起,该身份证号码无法通过验证,请检查!","系统提示",MessageBoxButtons.OK, MessageBoxIcon.Information)
       End If
    End If
End If

--  作者:有点蓝
--  发布时间:2016/9/19 12:09:00
--  
测试有没有错误,结果是否正确就知道了
--  作者:nbsfy
--  发布时间:2016/9/19 12:39:00
--  
可以了!谢谢!