对于Winform中的MSSQL更新,我想多次更新这些表。
您能给我评论吗?这将是一个简单的问题。
UPDATE PC SET PC.statusId = '3', Rental.RealReturnDate = '2018-11-12', Rental.Reason = ''
FROM PC, Rental WHERE PC.rentalId = Rental.rentalId AND tagNo = 'EK18LT00002'
答案 0 :(得分:1)
您可以在下面尝试
BEGIN TRANSACTION;
UPDATE PC
SET PC.statusId = '3'
FROM PC inner join Rental
on PC.rentalId = Rental.rentalId
where tagNo = 'EK18LT00002' ;
UPDATE Rental
SET Rental.RealReturnDate = '2018-11-12', Rental.Reason = ''
FROM PC inner join Rental
on PC.rentalId = Rental.rentalId
where tagNo = 'EK18LT00002';
COMMIT