我有一个“增加”按钮 如下命令:其中如果“设备编码”条件内容为空、那么在其他条件完全相同的情况下还是会新增一行、如果“设备编码”有内容、那么点击按钮后就不会再新增一行。为什么?
Dim d1 As String = e.Form.Controls("机房名称").Text
Dim t11 As String = e.Form.Controls("设备名称").Text
Dim t12 As String = e.Form.Controls("设备型号").Text
Dim t13 As String = e.Form.Controls("设备编号").Text
Dim c1 As String = e.Form.Controls("板件槽位1").Text
Dim t1 As String = e.Form.Controls("板件型号1").Text
Dim nd2 As DataRow = DataTables("机房设备板件表").Find("机房名称 = '" & d1 & "' and 设备名称 = '" & t11 & "' and 设备型号 = '" & t12 & "' and 设备编号 = '" & t13 & "'and 板件槽位 = '" & c1 & "'and 板件型号 = '" & t1 & "'")
If nd2 Is Nothing Then
If c1 > "" And t1 > "" Then
nd2 = DataTables("机房设备板件表").AddNew()
nd2("机房名称") = d1
nd2("设备名称") = t11
nd2("设备型号") = t12
nd2("设备编号") = t13
nd2("板件槽位") = c1
nd2("板件型号") = t1
End If
End If
[此贴子已经被作者于2014-9-1 22:34:47编辑过]