直接这样写
If e.DataCol.Name = "结果" AndAlso e.DataRow.isnull("工号") = False Then Dim dr As DataRow =DataTables("总库").Find("工号 = '" & e.DataRow("工号") & "'") If dr IsNot Nothing Then If e.NewValue = "离职" Then dr("状态")="离职" Else If e.NewValue = "病假" Then dr("学籍状态")="病假" Else If e.NewValue = "调动" Then dr("部门") = e.DataRow("部门") End If End If End If