改成下面的代码
Dim dr As DataRow=e.DataRow
If e.DataCol.Name = "姓名" OrElse e.DataCol.Name = "出生日期" Then
If dr.IsNull("姓名") OrElse dr.IsNull("出生日期") Then
dr("patientsID") = Nothing
Else
Dim s1 As Date=dr("出生日期")
dr("patientsID")=dr("姓名") & format(s1,"yyyyMMdd")
End If
Else If e.DataCol.Name="patientsID" Then
If e.NewValue.Length > 6 Then
Dim s As String = e.NewValue
Dim s1 As Integer =s.Length
Dim s2 As String = s.SubString(0, s1-8)
Dim s3 As String = s.SubString(s1-8)
dr("姓名") = s2
dr("出生日期") = new Date(s3.SubString(0,4), s3.SubString(4,2), s.SubString(6,2))
End If
End If