数据库中有对应的数据记录则更新数据,无对应的数据记录则插入数据。
if exists(select saleId from Photo_Sale_Picture where saleId = @saleId) UPDATE Photo_Sale_Picture SET SaleId=@saleId,UsingRange=@usingRange,IsPortrait=@isPortrait,MarketPrice=@marketPrice, CopyrightPrice=@copyrightPrice,UsingPrice=@usingPrice,SystemColumnID=@systemColumnId, PortraitImg=@portraitImg where SaleId=@saleId; else insert into Photo_Sale_Picture(SaleId,UsingRange,IsPortrait,MarketPrice, CopyrightPrice,UsingPrice,SystemColumnID,PortraitImg) values(@saleId,@usingRange,@isPortrait,@marketPrice,@copyrightPrice, @usingPrice,@systemColumnId,@portraitImg);