From your original thread, it seems your select clause issue is resolved but your update clause is not working properly. I think it's the same issue like select clause as it has ItemName = @Original_ItemName, Please modify your update clause like below.
UPDATE [VendorReq] SET [PartNo] = @PartNo, [Quantity] = @Quantity,
[Unit] = @Unit, [Price] = @Price, [TotalPrice] = @TotalPrice, [Description] = @Description, [Selected] = @Selected
WHERE [RequestNo] = @original_RequestNo AND [VendorName] = @original_VendorName
AND (REPLACE(ItemName, '"', '"') = @original_ItemName)
AND (([PartNo] = @original_PartNo) OR ([PartNo]IS NULL AND @original_PartNo IS NULL)) AND [Quantity] = @original_Quantity AND (([Unit] = @original_Unit)
OR ([Unit] IS NULL AND @original_Unit IS NULL)) AND (([Price] = @original_Price) OR ([Price] IS NULL
AND @original_Price IS NULL)) AND (([TotalPrice] = @original_TotalPrice) OR ([TotalPrice] IS NULL
AND @original_TotalPrice IS NULL)) AND (([Description] = @original_Description) OR ([Description] IS NULL
AND @original_Description IS NULL)) AND [Selected] = @original_Selected
Best Regards,
Please mark the replies as answers if they help or unmark if not.
Feedback to us
alch3mist291
0 Points
31 Posts
Parameters in SQL query
Nov 16, 2012 05:56 PM|LINK
Can anybody please tell me how to use REPLACE in parameters
I want modify the parameter (in bold on below query)
"SELECT * FROM [VendorReq] WHERE (([RequestNo] = @RequestNo) AND (REPLACE([ItemName],'"','"') = @ItemName))"
Note : I am trying to update db from a gridview.but failing.
Original Issue
niksv
Contributor
5925 Points
1115 Posts
Re: Parameters in SQL query
Nov 18, 2012 11:20 AM|LINK
REPLACE(@ItemName,'"','"')
RameshRajend...
Star
7983 Points
2099 Posts
Re: Parameters in SQL query
Nov 18, 2012 11:48 AM|LINK
refer this
http://sqlserverplanet.com/tsql/sql-replace
http://www.razorleaf.com/2009/12/sql-replace/
Thank you...
Chen Yu - MS...
All-Star
21581 Points
2493 Posts
Microsoft
Re: Parameters in SQL query
Nov 21, 2012 03:00 AM|LINK
Hi,
From your original thread, it seems your select clause issue is resolved but your update clause is not working properly. I think it's the same issue like select clause as it has ItemName = @Original_ItemName, Please modify your update clause like below.
Best Regards,
Feedback to us
Develop and promote your apps in Windows Store