谢谢,请问可以两端代码合成一段吗,是否可以提升速度:
If e.DataCol.Name = "提交" AndAlso e.DataRow("提交") = True AndAlso e.DataRow("属性") = "生产" Then
Dim nma() As String = {"序列号","名称","规格","需求数量","属性","计划数量","订单号","产品名称"} 'A表数据来源列
Dim nmb() As String = {"序列号","名称","规格","需求数量","属性","计划数量","订单号","产品名称"} 'B表数据接收列
Dim dr As DataRow = DataTables("PMC车间计划").find("序列号='" & e.DataRow("序列号") & "' and 名称='" & e.DataRow("名称") & "'")
If dr Is Nothing Then dr = DataTables("PMC车间计划").AddNew
For i As Integer = 0 To nma.Length - 1
dr(nmb(i)) = e.DataRow(nma(i))
Next
End If
If e.DataCol.Name = "提交" AndAlso e.DataRow("提交") = True AndAlso e.DataRow("属性") = "采购" Then
Dim nma() As String = {"序列号","名称","规格","需求数量","属性","计划数量","订单号","产品名称"} 'A表数据来源列
Dim nmb() As String = {"序列号","名称","规格","需求数量","属性","计划数量","订单号","产品名称"} 'B表数据接收列
Dim dr As DataRow = DataTables("PMC车间计划").find("序列号='" & e.DataRow("序列号") & "' and 名称='" & e.DataRow("名称") & "'")
If dr Is Nothing Then dr = DataTables("采购计划").AddNew
For i As Integer = 0 To nma.Length - 1
dr(nmb(i)) = e.DataRow(nma(i))
Next
End If
[此贴子已经被作者于2019/6/21 17:14:37编辑过]