代码如下
If e.DataCol.Name = "运单编号" Then '如果内容发生变动的是产品列
If e.NewValue Is Nothing Then '如果新值是空白,也就是产品列的内容为空
e.DataRow("客户名称") = Nothing
Else
Dim dr As DataRow
Dim N As Date = e.DataRow("扫描日期")
dr = DataTables("top_trade").sqlFind("[top_out_sid] = '" & e.DataRow("运单编号") & "'")
If dr IsNot Nothing Then '如果找到了同名的产品行,也就是dr不是Nothing
e.DataRow("客户名称") = dr("top_seller_nick")
e.DataRow("年月")=N.year & "年" & N.Month & "月"
Else
e.DataRow("客户名称") = Nothing
End If
End If
End If
以上代码 单条运行还行 数据量几百上千条的时候 运行非常缓慢
但是 把 dr = DataTables("top_trade").sqlFind("[top_out_sid] = '" & e.DataRow("运单编号") & "'") 中的 sqlFind改为 Find 后 就很快
求高手 解答