Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Stored Procedure Help!

Author  Topic 

pizzojm
Starting Member

20 Posts

Posted - 2001-10-08 : 09:33:41
Hello,

I am trying to convert my embedded SQL in my ASP pages to stored procedures. I am running SQL Server 2000, on a Windows 2000 Server with updated Service Packs. I have run into a problem with some of this... Here is the code from before:


'********

SQL3="SELECT distinct * FROM tblOrders_Products WHERE orderID=" & request.form("orderID")
set RS3 = connection.execute(SQL3)

While NOT RS3.EOF

SQL2="SELECT * FROM tblOrders_Products WHERE orderID=" & request.form("orderID") & " AND itemID='" & RS3.Fields("itemID") & "'"

set RS2 = connection.execute(SQL2)

addValue = CInt(RS2.Fields("opQty"))-CInt(request.form(RS3.Fields("itemID")))

SQL4="UPDATE tblOrders_Products SET opQty = " & request.form(RS3.Fields("itemID")) & " WHERE orderID=" & request.form("orderID") & " AND itemID='" & RS3.Fields("itemID") & "'"

SQL5="UPDATE tblInventory SET itemQty = itemQty + " & addValue & " WHERE itemID='" & RS3.Fields("itemID") & "'"

connection.execute(SQL4)
connection.execute(SQL5)

RS3.MoveNext
Wend

'********

This code is for an Update Order page where users can go and change specific quantities and other values for orders that have already been placed. The values for the specific products are stored in the tblOrders_Products Table, while the actual orders are in the tblOrders Table. I need to know how to do these SQL statements using a stored procedure.

Thanks!


   

- Advertisement -