1、上面的实例我测试没有问题,按什么步骤测试会有问题?
3、代码的顺序不对,勾选后业务员还没有值。要先给业务员赋值,在复制数据
If e.DataCol.Name = "传递报价" Then
If e.DataRow("传递报价") = True Then
e.DataRow("录入时间") = Date.Today()
e.DataRow("业务员") = User.Name
Else
e.DataRow("业务员") = Nothing
e.DataRow("录入时间") = Nothing
End If
End If
If e.DataCol.Name = "传递报价" AndAlso e.DataRow("传递报价") = True Then
Dim nma() As String = {"图号", "业务员"} 'A表数据来源列
Dim nmb() As String = {"图号","业务员"} 'B表数据接收列
Dim dr As DataRow = DataTables("报价管理系统").AddNew
For i As Integer = 0 To nma.Length - 1
dr(nmb(i)) = e.DataRow(nma(i))
Next
End If
上面2段代码可以合并到一起
If e.DataCol.Name = "传递报价" Then
If e.DataRow("传递报价") = True Then
e.DataRow("录入时间") = Date.Today()
e.DataRow("业务员") = User.Name
Dim nma() As String = {"图号", "业务员"} 'A表数据来源列
Dim nmb() As String = {"图号","业务员"} 'B表数据接收列
Dim dr As DataRow = DataTables("报价管理系统").AddNew
For i As Integer = 0 To nma.Length - 1
dr(nmb(i)) = e.DataRow(nma(i))
Next
Else
e.DataRow("业务员") = Nothing
e.DataRow("录入时间") = Nothing
End if
End If