Select Case e.DataCol.Name
Case "sfzh"
If e.DataRow.IsNull("sfzh") Then '身份证号码是否为空
e.DataRow("出生日期") = Nothing '如果为空,则清除出生日期
e.DataRow("性别") = Nothing '如果为空,则清除出生日期
e.DataRow("年龄") = Nothing '如果为空,则清除年龄
Else
'否则从身份证号码列中提取出生日期
e.DataRow("出生日期") = ReadBirthday(e.DataRow("sfzh"))
e.DataRow("性别") = ReadSex(e.DataRow("sfzh"))
Dim y,m,d As Integer
m=08
d=31
DateYMD(ReadBirthday(e.DataRow("sfzh")),Date.Today,y,m,d)
e.DataRow("年龄") = y
End If
Case "出生日期"
If e.DataRow.IsNull("出生日期") Then
e.DataRow("年") = Nothing
e.DataRow("月") = Nothing
e.DataRow("日") = Nothing
Else
Dim str As String = cldate(e.NewValue)
Dim ary() As String = str.Split(new Char() {"年", "月", "日"})
e.DataRow("年") = ary(0)
e.DataRow("月") = ary(1)
e.DataRow("日") = ary(2)
End If
End Select
身份证转出生日期 目前是1993-01-30 00:00:00,需输出结果是19930130格式
[此贴子已经被作者于2017/6/28 23:26:42编辑过]