简体   繁体   中英

updating all data in one row sql server vb.net

im using vb.net 2005 and sql server 2005
i want to update all data in one row in one click button in vb.net
for example

stock | last_stock  
1        2   
1        3
1        4

if i click update button in my vb.net project it becomes

stock | last_stock  
2        2   
3        3
4        4

all i know is update single data, please help
i try with

update barang set (stock) ='" &textbox1.text& "' where barang.id_barang = transaksi.id_barang

Without WHERE clause UPDATE will affect all rows in your table

UPDATE barang SET stock = last_stock

Here is SQLFiddle demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM