表B,datacolchanged事件
Select Case e.DataCol.Name
Case "企业名称","风险值"
If e.DataRow.IsNull("企业名称") OrElse e.DataRow.IsNull("风险值")
e.DataRow("风险等级") = Nothing
Else
Dim dr As DataRow = DataTables("表A").Find("企业名称='" & e.DataRow("企业名称") & "' and 风险等级 <= " & e.DataRow("风险值") & " and 风险等级 >=" & e.DataRow("风险值"))
If dr Is Nothing Then
dr = DataTables("表A").Find("企业名称='通用' And R1 <= " & e.DataRow("风险值") & " and R2 >=" & e.DataRow("风险值"))
End If
If dr Is Nothing Then
e.DataRow("风险等级") = Nothing
Else
e.DataRow("风险等级") = dr("风险等级")
End If
End If
End Select