If e.DataCol.Name = "身份证号码" Then '如果更改的是身份证号码列
If e.DataRow.IsNull("身份证号码") OrElse ValidPIN(e.DataRow("身份证号码")) = False Then '身份证号码是否为空
e.DataRow("出生日期") = Nothing '如果为空,则清除出生日期
e.DataRow("性别") = Nothing
Else
'否则从身份证号码列中提取出生日期
e.DataRow("出生日期") = ReadBirthday(e.DataRow("身份证号码"))
'MessageBox.Show(ReadSex(e.DataRow("身份证号码")))
'e.DataRow("性别") = ReadSex(e.NewValue)
e.DataRow("性别")= ReadSex(e.DataRow("身份证号码"))
Dim bm As String = e.DataRow("身份证号码").SubString(0,6)
Dim cmd As new SQLCommand
cmd.C
cmd.CommandText=" sele ct 籍贯 from {身份证籍贯编码} wh ere 籍贯编码= '" & bm & "'"
' MessageBox.Show(bm)
Dim dt As DataTable
dt = cmd.ExecuteReader()
If dt.DataRows.Count > 0 Then
e.DataRow("籍贯")=dt.DataRows(0)("籍贯")
End If
End If
End If