Problem with stored procedure

Results 1 to 3 of 3

Thread: Problem with stored procedure

  1. #1
    Scott Phelps Guest

    Default Problem with stored procedure

    Here is a stored procedure I am calling from an ASP page:<BR><BR>-----------------------------------------<BR>CREATE PROCEDURE sp_RetrieveOrders<BR><BR>@idShopper int<BR><BR>AS<BR><BR>select * from OrderData, OrderStatus, basket<BR>where @idShopper = @idShopper and<BR> OrderData.idOrder = OrderStatus.idOrder and<BR> basket.idBasket = OrderData.idBasket<BR><BR>-----------------------------------------<BR><BR>Here&#039s how it is being called:<BR><BR>-----------------------------------------<BR><BR>sql = "execute sp_RetrieveOrders " & rsProfile("idShopper")<BR>set rsOrders = dbOrders.Execute(sql)<BR><BR>-----------------------------------------<BR><BR>I get no errors, but all the orders are displayed for every "idShopper".<BR><BR>I am just learning ASP and I&#039m finding this very frustrating!<BR><BR>Thanks in advance for any help,<BR>Scott Phelps

  2. #2
    Join Date
    Dec 1969

    Default RE: Problem with stored procedure

    Copy your select statement into a query window, run it and you will find the problem.<BR><BR>From your posted code, @idShopper = @idShopper this statement will ALWAYS be true. Try modifying your sp text to:<BR><BR>select * from OrderData, OrderStatus, basket<BR>where OrderData.idShopper = @idShopper<BR>and OrderData.idOrder = OrderStatus.idOrder<BR>and OrderData.idBasket = basket.idBasket<BR>

  3. #3
    Scott Phelps Guest

    Default RE: Problem with stored procedure

    It makes so much sense now that someone has pointed it out!<BR>I would like to mention that I pulled that example from "Visual Basic Developers Guide to E-Commerce with ASP and SQL server" The scope of the book builds a sample store, and this is not the first error in the coding from the book I&#039ve run into. Thanks for your help, I hope I won&#039t need as much very soon!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts