测试了一下,如果没有下面红色部分这个判断条件,命令就可以正常执行;加入该判断命令就不行。(该命令的作用是想 判断 如果当前表“机房设备板件表”的‘设备编号’列未输入内容,就执行下面的命令)
Dim dr As DataRow = e.DataRow
If DataTables("机房设备板件表").DataCols("设备编号") Is Nothing Then
Dim fdr As DataRow = DataTables("机房板件端口表").Find("设备名称 = '" & dr("设备名称") & "' and 设备型号 = '" & dr("设备型号") & "' and 板件型号 = '" & dr("板件型号") & "' and 机房名称 = '" & dr("机房名称") & "' and 板件槽位 = '" & dr("板件槽位") & "' And 业务名称 Is not null")
'Dim fdr As DataRow = DataTables("机房板件端口表").Find("设备名称 = '" & dr("设备名称") & "' and 设备型号 = '" & dr("设备型号") & "' and 板件型号 = '" & dr("板件型号") & "' and 机房名称 = '" & dr("机房名称") & "' and 板件槽位 = '" & dr("板件槽位") & "' and 设备编号 = '" & dr("设备编号") & "' and 业务名称 is not null")
If fdr IsNot Nothing Then
msgbox("有内容,不能删除")
e.Cancel = True
Else
DataTables("机房板件端口表").DeleteFor("设备名称 = '" & dr("设备名称") & "' and 设备型号 = '" & dr("设备型号") & "' and 板件型号 = '" & dr("板件型号") & "' and 机房名称 = '" & dr("机房名称") & "' and 板件槽位 = '" & dr("板件槽位") & "'")
End If
End If