|
I am working on a new ASP.NET 2.0 application. I have a stored procedure as follows that is giving me some grief: ALTER PROCEDURE dbo.LeaveFeedback ( @varUser varchar(max), @varID int, @varFeedback text, @varFeedbackLeftFor varchar(max), @varPositiveOrNegative int, @varOfferer varchar(max), @varIsRCom int, @varIsOCom int ) AS /* SET NOCOUNT ON */ INSERT INTO UserFeedback (UserName, Feedback, PosNeg, Item, LeftBy) VALUES (@varFeedbackLeftFor, @varFeedback, @varPositiveOrNegative, @varID, @varUser) SET @varOfferer=(select offerer from AvailableFeedback where Item=@varID) If @varOfferer=@varUser BEGIN UPDATE AvailableFeedback set OffererComplete=1 where Item=@varID END Else BEGIN UPDATE AvailableFeedback set RequestorComplete=1 where Item=@varID END SET @varIsRCom=(select RequestorComplete from AvailableFeedback where Item=@varID) SET @varIsOCom=(select OffererComplete from AvailableFeedback where Item=@varID) If @varISOCom=1 AND @varISRCom=1 BEGIN DELETE FROM AvailableFeedback where Item=@varID END RETURN
The code is divided into several blocks: 1. Variable declarations. 2. Add feedback to feedback table. 3. Determine whether it was the offerer or requestor who left the feedback, and update the field that notes whether they left feedback. 4. If both offerer and requestor have left feedback, delete the entry from the table so that they can't leave multiple feedback on the same item. Now, the adding of the feedback works fine, but it fails to get past this point. Any ideas why? David.
|