0
我有许多行更新/插入使用TableAdapter
s的SQL Server数据库。有没有办法将它们批处理在一起,以便它仍然是一个UPDATE
语句的列表,至少它只是一个远程调用数据库的方式?C#数据集批量更新
如果我手动编写SQL,这将是一个单一的SqlCommand
对象与CommandText
看起来是这样的:
update mytable set col = val where id = 1
update mytable set col = val where id = 2
update mytable set col = val where id = 3
...
update mytable set col = val where id = 432
那我就只是叫SqlCommand.ExecuteNonQuery();
很可爱,谢谢。 – 2009-10-16 09:11:02