ALTER PROCEDURE [dbo].[SP_Updatemstproduct](@poProductId int ,@caCategoryId int,@poProductName varchar(200),@poDescription varchar(300),@poSmallImage varchar(200),@poIsActive varchar(1), @poOrder int--@poCreatedDate datetime)ASBEGIN IF (@poSmallImage = '')beginUPDATE [mst_product] SET [caCategoryId] = @caCategoryId, [poProductName] = @poProductName, [poDescription] = @poDescription, [poSmallImage] = @poSmallImage, [poIsActive] = @poIsActive, [poOrder]=@poOrder --[poCreatedDate] = @poCreatedDate WHERE poProductId=@poProductIdENDelsebeginUPDATE [mst_product] SET [caCategoryId] = @caCategoryId, [poProductName] = @poProductName, [poDescription] = @poDescription, --[poSmallImage] = @poSmallImage, [poIsActive] = @poIsActive, [poOrder]=@poOrder --[poCreatedDate] = @poCreatedDate WHERE poProductId=@poProductIdend endWhat I have tried:actually I m tried the database is same image does not update in database I used this code for in updateif (fileImage.PostedFile != null) { string FileName = Path.GetFileName(fileImage.PostedFile.FileName); fileImage.SaveAs(Server.MapPath("Images/" + FileName));and this field is use to update SPcmd2.Parameters.AddWithValue("@poSmallImage", "Images/" + FileName); 解决方案 这篇关于使用if-else语句在数据库中不更新相同的映像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-28 22:54