If e.DataTable.Name <> "变更记录" Then '数据变更记录
Dim dr As DataRow = DataTables("变更记录").AddNew
dr("表名") = e.DataTable.Name
dr("列名") = e.DataCol.Name
dr("行号") = e.DataRow("_Identify")
dr("时间") = Date.Now
dr("操作") = """" & e.OldValue & """ 改成了 """ & e.NewValue & """"
End If
messagebox.show(1)
If e.DataCol.Name = "零件图号" Then '订单零件名称,含税单价,供应商简称的来源
Dim nms() As String = {"零件名称","A点_含税单价_更新后","A点_供应商简称"}
If e.NewValue Is Nothing Then
For Each nm As String In nms
e.DataRow(nm) = Nothing
Next
messagebox.show(2)
Else
Dim dr As DataRow
dr = DataTables("价格表").Find("[零件图号] = '" & e.NewValue & "'")
If dr IsNot Nothing
For Each nm As String In nms
e.DataRow(nm) = dr(nm)
Next
End If
End If
End If
messagebox.show(3)
If e.DataCol.Name = "供应商简称" Then '合同采购通则和供应商代码更新
Dim esb() As String = {"供应商代码","合同编号_采购通则"}
If e.NewValue Is Nothing Then
For Each es As String In esb
e.DataRow(es) = Nothing
Next
Else
messagebox.show(4)
Dim dt As DataRow
dt = DataTables("供应商信息表").Find("[供应商简称] = '" & e.NewValue & "'")
If dt IsNot Nothing
For Each es As String In esb
e.DataRow(es) = dt(es)
Next
End If
End If
End If
messagebox.show(5)
上面程序运行提示如下:
.NET Framework 版本:2.0.50727.3655
Foxtable 版本:2014.11.11.1
错误所在事件:全局表事件, DataColChanged
详细错误信息:
调用的目标发生了异常。
Substring()参数超出范围。
参数名: length
我加messagebox.show()测试,提示是1,点下就是3,再点就是5,求高手