还是不行。我采用先插入,再更新的方法。
Dim cm d As New SQLComman d
cm d.ConnectionNam e = "vip"
For Each dr As DataRow In DataTables("销售明细").DataRows
cm d.CommandText =" insert into 销售明细(单号,销售时间) values ( '" & d r("单号") & "','" & d r("销售时间") & "')"
cm d.ExecuteNonQuery()
Next
cm d.commandtext = "updat e 销售明细 s et 单数 = 1 wher e 单数 is null"
cm d.ExecuteNonQuery()
但这样好慢:
因为我们每天都要上传一次数据,这样每次都要从上百万条记录中找到 wher e 单数 is null 的才更新
我在想能不能在每天导入的数据里去 更新,每次也才几千条。这样会快点。
[此贴子已经被作者于2016/11/14 22:12:22编辑过]