Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - What's Wrong with This Code?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

What's Wrong with This Code?

 Post Reply Post Reply
Author
davidshq View Drop Down
Senior Member
Senior Member


Joined: 29 July 2003
Location: United States
Status: Offline
Points: 299
Post Options Post Options   Thanks (0) Thanks(0)   Quote davidshq Quote  Post ReplyReply Direct Link To This Post Topic: What's Wrong with This Code?
    Posted: 25 May 2006 at 3:29am
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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.