老师您好!我的代码运行出现如下报错:
此主题相关图片如下:qq截图20150923142607.jpg

请问这可能是什么原因呢?
我的代码原本是:
If e.DataCol.Name = "结果"
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("状态")="病假"
End If
End If
End If
运行是没有问题的。但是我需要加上调职这一个变动,涉及到数据的引入,所以要定义另一张工作表,我尝试做了下:
For Each dr1 As DataRow In DataTables("总表").DataRows
If e.DataCol.Name = "结果" 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("部门") = dr1("部门")
End If
End If
End If
Next
所以就出现如上错误。
请教老师们,这主要是因为什么呢?怎么解决?
十分感谢!