什么数据库?access?SqlServer?
直接update,效率更高
Dim cmd As New SQLCommand
cmd.ConnectionName = "H"
Dim Filter As String = "[上游客户] = '" & e.DataRow("上游客户") & "' And [品牌] = '" & e.DataRow("品牌") & "'And [上游动态] = '" & e.DataRow("上游动态") & "' And [计划日期] >= #" & e.DataRow("起始日期") & "# And [计划日期] <= #" & e.DataRow("终止日期") & "# And 上游对账 = False And 二次 = false"
cmd.CommandText = "update {运单管理} set 上游单价=“ & e.DataRow("上游单价") & ” Where " & Filter
dim res as integer = cmd.ExecuteNonQuery()
msgbox("更新了" & res)
cmd.CommandText = "update {运单管理} set 上游单价=null Where not(" & Filter & ")"
res =cmd.ExecuteNonQuery()
msgbox("更新了" & res)
End Select