--
事件DataColChanging
Select Case e.DataCol.Name
Case "电压互感器条码_A","电压互感器条码_B","电压互感器条码_C"
Dim dr As DataRow
dr = e.DataTable.SQLFind("电压互感器条码_A= \'" & e.NewValue & "\'")
If dr IsNot Nothing Then
MessageBox.Show("此电压互感器已经存在!" &dr("站名")& dr("PT线路编号"))
e.Cancel = True
Else
dr = e.DataTable.SQLFind("电压互感器条码_B= \'" & e.NewValue & "\'")
If dr IsNot Nothing Then
MessageBox.Show("此电压互感器已经存在!" &dr("站名")& dr("PT线路编号"))
e.Cancel = True
Else
dr = e.DataTable.SQLFind("电压互感器条码_C= \'" & e.NewValue & "\'")
If dr IsNot Nothing Then
MessageBox.Show("此电压互感器已经存在!" &dr("站名")& dr("PT线路编号"))
e.Cancel = True
Else
dr=DataTables("高供高计互感器").SQLFind("电压互感器条码_A = \'" & e.NewValue & "\'")
If dr IsNot Nothing Then
MessageBox.Show("此电压互感器已经存在!" &dr("名称"))
e.Cancel = True
Else
dr=DataTables("高供高计互感器").SQLFind("电压互感器条码_B = \'" & e.NewValue & "\'")
If dr IsNot Nothing Then
MessageBox.Show("此电压互感器已经存在!" &dr("名称"))
e.Cancel = True
Else
dr=DataTables("高供高计互感器").SQLFind("电压互感器条码_C = \'" & e.NewValue & "\'")
If dr IsNot Nothing Then
MessageBox.Show("此电压互感器已经存在!" &dr("名称"))
e.Cancel = True
End If
End If
End If
End If
End If
End If
Case "电压互感器出厂编号_A","电压互感器出厂编号_B","电压互感器出厂编号_C"
Dim dr As DataRow
dr = e.DataTable.SQLFind("电压互感器出厂编号_A= \'" & e.NewValue & "\'")
If dr IsNot Nothing Then
MessageBox.Show("此电压互感器已经存在!" &dr("站名")& dr("PT线路编号"))
e.Cancel = True
Else
dr = e.DataTable.SQLFind("电压互感器出厂编号_B= \'" & e.NewValue & "\'")
If dr IsNot Nothing Then
MessageBox.Show("此电压互感器已经存在!" &dr("站名")& dr("PT线路编号"))
e.Cancel = True
Else
dr = e.DataTable.SQLFind("电压互感器出厂编号_C= \'" & e.NewValue & "\'")
If dr IsNot Nothing Then
MessageBox.Show("此电压互感器已经存在!" &dr("站名")& dr("PT线路编号"))
e.Cancel = True
Else
dr=DataTables("高供高计互感器").SQLFind("电压互感器出厂编号_A = \'" & e.NewValue & "\'")
If dr IsNot Nothing Then
MessageBox.Show("此电压互感器已经存在!" &dr("名称"))
e.Cancel = True
Else
dr=DataTables("高供高计互感器").SQLFind("电压互感器出厂编号_B = \'" & e.NewValue & "\'")
If dr IsNot Nothing Then
MessageBox.Show("此电压互感器已经存在!" &dr("名称"))
e.Cancel = True
Else
dr=DataTables("高供高计互感器").SQLFind("电压互感器出厂编号_C = \'" & e.NewValue & "\'")
If dr IsNot Nothing Then
MessageBox.Show("此电压互感器已经存在!" &dr("名称"))
e.Cancel = True
End If
End If
End If
End If
End If
End If
End Select
出厂编号查找运行没有问题,条码查找的代码问题在哪里?