Select Case e.DataCol.Name
Case "学校名称"
Dim dr As DataRow = DataTables("片区校名一览表").Find("学校简称2字符 = '" & e.DataRow("学校名称") & "'")
If dr IsNot Nothing Then
e.DataRow("学校编码") = dr("学校编码")
Else
e.DataRow("学校编码") = Nothing
End If
Case "年级简称"
Dim dr1 As DataRow = DataTables("片区年级一览表").Find("年级简称 = '" & e.DataRow("年级简称") & "'")
If dr1 IsNot Nothing Then
e.DataRow("年级编码") = dr1("年级编码")
Else
e.DataRow("年级编码") = Nothing
End If
Case "班级序号","学校编码","年级编码"
If e.DataRow.IsNull("学校编码") OrElse e.DataRow.IsNull("年级编码") OrElse e.DataRow.IsNull("班级序号") Then
e.DataRow("班级编号") = Nothing
Else
e.DataRow("班级编号") = e.DataRow("学校编码") & e.DataRow("年级编码") & e.DataRow("班级序号")
End If
End Select