splanton
asked on
Classic ASP returning a value from a SQl Server Stored procedure into VBScript variable
I have a SQL Server 2008 Stored procedure that looks like this:
I am trying to call the Stored procedure from ASP like this:
It runs just fine (as you would expect).
The question is: How do i get the resulting NewOrderReference back into a VBScript variable for use on the page?
create procedure [dbo].[usp_NewOrderReference]
(@NewOrderReference Char(10) OUTPUT)
AS
BEGIN
SET @NewOrderReference = (SELECT 'ORD' + RIGHT ('0000000' + CAST(OrderNumber AS VARCHAR (10)),7) FROM [OrderReference])
UPDATE OrderReference Set OrderNumber = (OrderNumber +1)
END
I am trying to call the Stored procedure from ASP like this:
<%
SQLStmt = "exec.dbo.usp_NewOrderReference '';"
Set RS_Result01 = Connection01.Execute(SQLStmt)
%>
It runs just fine (as you would expect).
The question is: How do i get the resulting NewOrderReference back into a VBScript variable for use on the page?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Actual syntax I used to test was :
<%
SQLStmt = "exec.dbo.usp_NewOrderRefe
Set RS_Result01 = Connection01.Execute(SQLSt
v_neworderreference = RS_Result01(0)
response.write("New order reference = "+ v_neworderreference)
%>