Why this procedure does not work ?

  • Why this procedure does not work ?

     

    I intended to make updates in two different tables with just one procedure:

     

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ALTER PROCEDURE UpdateNonEbookOrders2

    (@OrderID INT,

     @ProductID INT,

     @UserName VARCHAR(50),

     @FirstName VARCHAR(50),

     @LastName VARCHAR(150),

     @CustomerEmail VARCHAR(50),

     @NumOfItems INT,

     @ShippingAddress VARCHAR(500),

     @ShippingCity VARCHAR(50),

     @ShippingCounty VARCHAR(50),

     @ShippingZip VARCHAR(20),

     @ShippingCountry VARCHAR(50),

     @ShippingTelephone VARCHAR(50),

     @DateCreated SMALLDATETIME,

     @PaymentConfirmed BIT,

     @Completed BIT,

     @Canceled BIT,

     @Comments VARCHAR(500),

     @ProductName VARCHAR(100),

     @IsEbook BIT,

     @Quantity INT,

     @Prepared BIT,

     @DateSent SMALLDATETIME,

     @Received BIT,

     @UnitCost MONEY)

    AS

    UPDATE OrderDetail

    SET ProductName = @ProductName, IsEbook = @IsEbook, Quantity = @Quantity,Prepared = @Prepared,

    DateSent = @DateSent, Received = @Received, UnitCost = @UnitCost

    WHERE OrderID = @OrderID AND ProductID = @ProductID

     

    UPDATE Orders

    SET UserName = @UserName, FirstName = @FirstName, LastName = @LastName, CustomerEmail = @CustomerEmail,

    NumOfItems = @NumOfItems, ShippingAddress = @ShippingAddress, ShippingCity = @ShippingCity,

    ShippingCounty = @ShippingCounty, ShippingZip = @ShippingZip, ShippingCountry = @ShippingCountry,

    ShippingTelephone = @ShippingTelephone, DateCreated = @DateCreated, PaymentConfirmed = @PaymentConfirmed,

    Completed = @Completed, Canceled = @Canceled, Comments = @Comments

    WHERE OrderID = @OrderID

  • What's the error message?

  • Hi Anders

    I just found out that the procedure is fine. The error actually was in a method that was passing the value of a wrong variable.

    Thank you, anyway.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply