Avatar of splanton
splanton
Flag for United Kingdom of Great Britain and Northern Ireland 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:

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

Open in new window


I am trying to call the Stored procedure from ASP like this:

<%
	SQLStmt = "exec.dbo.usp_NewOrderReference '';"
	Set RS_Result01 = Connection01.Execute(SQLStmt)

%>

Open in new window


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?
ASPVisual Basic ClassicMicrosoft SQL Server

Avatar of undefined
Last Comment
splanton

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Big Monty

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
splanton

ASKER
Thanks for that.

Actual syntax I used  to test was :

<%
      SQLStmt = "exec.dbo.usp_NewOrderReference '';"
      Set RS_Result01 = Connection01.Execute(SQLStmt)
      v_neworderreference = RS_Result01(0)
      response.write("New order reference = "+ v_neworderreference)
%>
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck