说明这一列是表达式列,表达式列不能用代码修改值,排除掉表达式列:
Dim r As Row = Tables("报价单").Current
Dim dnew As Row = Tables("报价单").AddNew
Dim name As String = r("订单编号") & "*"
For Each c As Col In Tables("报价单").Cols
If c.DataCol.Expression = "" Then
If c.Name = "订单编号" Then
dnew(c.Name) = name
ElseIf c.Name <> "_Identify" Then
dnew(c.Name) = r(c.Name)
End If
End If
Next
Tables("报价单").Current("财务审核") = Nothing
Tables("报价单").Current("总经理审批") = Nothing
Dim drs As List(Of DataRow)
drs = r.DataRow.GetChildRows("报价明细")
Dim rc As DataRow
For Each dr As DataRow In drs
rc = dr.Clone
rc("订单编号") = name
Next
或者直接判断列名:
Dim r As Row = Tables("报价单").Current
Dim dnew As Row = Tables("报价单").AddNew
Dim name As String = r("订单编号") & "*"
For Each c As Col In Tables("报价单").Cols
If c.Name <> "研发管理费" Then
If c.Name = "订单编号" Then
dnew(c.Name) = name
ElseIf c.Name <> "_Identify" Then
dnew(c.Name) = r(c.Name)
End If
End If
Next
Tables("报价单").Current("财务审核") = Nothing
Tables("报价单").Current("总经理审批") = Nothing
Dim drs As List(Of DataRow)
drs = r.DataRow.GetChildRows("报价明细")
Dim rc As DataRow
For Each dr As DataRow In drs
rc = dr.Clone
rc("订单编号") = name
Next
[此贴子已经被作者于2018/3/16 16:56:53编辑过]