是在测试代码、复制错了
Select Case e.DataCol.Name
Case "商户ID"
If e.DataRow.IsNull("商户ID") = False Then
e.DataRow("机具是否绑定") =True
Else
e.DataRow("机具是否绑定") = False
End If
End Select
If e.DataCol.Name = "商户ID" Then
If e.NewValue Is Nothing Then
e.DataRow("商户ID") = Nothing
Else
Dim dr As DataRow
dr = DataTables("商户资料表").Find("[商户ID] = '" & e.NewValue & "'")
If dr IsNot Nothing
e.DataRow("商户名称") = dr("商户名称")
e.DataRow("客户姓名") = dr("法人姓名")
End If
End If
End If
Select Case e.DataCol.Name
Case "机具ID"
Dim Filter As String = "[机具ID] = '" & e.oldvalue & "'"
Dim drs As List(Of DataRow) = DataTables("商户资料表").Select(Filter)
For Each dr As DataRow In drs
dr("机具ID") = e.NewValue
dr("机具条码") = e.DataRow("机具条码")
Next
Case "机具条码"
Dim Filter As String = "[机具ID] = '" & e.DataRow("机具id") & "'"
Dim drs As List(Of DataRow) = DataTables("商户资料表").Select(Filter)
For Each dr As DataRow In drs
dr("机具条码") = e.DataRow("机具条码")
Next
End Select
If e.DataCol.Name = "商户ID" Then
If e.NewValue Is Nothing Then
e.DataRow("商户名称") = Nothing
e.DataRow("客户ID") = Nothing
e.DataRow("客户姓名") = Nothing
Else
Dim dr As DataRow
dr = DataTables("商户资料表").Find("[商户ID] = '" & e.NewValue & "'")
If dr IsNot Nothing
e.DataRow("商户名称") = dr("商户名称")
e.DataRow("客户ID") = dr("客户ID")
e.DataRow("客户姓名") = dr("法人姓名")
End If
End If
End If
If e.DataCol.Name = "商户ID" Then 'POS机库存资料表数据和商户资料表数据同步
If e.OldValue <> Nothing Then
For Each dr As DataRow In DataTables("商户资料表").Select("商户id = '" & e.OldValue & "'")
dr("机具id") = Nothing
dr("机具条码") = Nothing
Next
End If
End If
我测试了,“机具是否绑定"字段值就是不发生变化?是做测试例子没问题,一到程序中测试就出问题,不知道什么原因?
不会合并,已合并代码就乱了
[此贴子已经被作者于2017/9/5 21:56:46编辑过]