|
|
|
|
|
| | |
|
Active Server Pages ASP a directory of ASP tutorials applications scripts components and articles for the novice to professional developer. CJWSoft ASPProtect ASPBanner ASPClassifieds
(Advanced)
(Components)
(Database)
(General)
(Vbscript)

|
|
Subject: |
Stored Procedure Return Value |
From: |
Tony |
Date: |
3/22/1999 11:37:05 PM |
IP: |
209.135.83.105 |
Hi all,
Can anyone tell me why I could not catch a returned value from a stored
procedure by using the following code (from MS web site
http://support.microsoft.com/support/kb/articles/q164/4/85.asp on IIS4/SQL
server 6.5 ? What I got was always a empty value for the variable
cmd.Parameters(0). Do we need to do something special to catach a value of
cmd.Parameters(0)?
Thanks.
Tony
---------------------------------------------
<%@ LANGUAGE="VBSCRIPT" %>
<!--#include virtual="/ASPSAMP/SAMPLES/ADOVBS.INC"-->
<HTML>
<HEAD><TITLE>Place Document Title Here</TITLE></HEAD>
<BODY>
This first method queries the data source about the parameters
of the stored procedure. This is the least efficient method of calling
a stored procedure.<BR>
<%
Set cn = Server.CreateObject("ADODB.Connection")
Set cmd = Server.CreateObject("ADODB.Command")
cn.Open "data source name", "userid", "password"
Set cmd.ActiveConnection = cn
cmd.CommandText = "sp_test"
cmd.CommandType = adCmdStoredProc
' Ask the server about the parameters for the stored proc
cmd.Parameters.Refresh
' Assign a value to the 2nd parameter.
' Index of 0 represents first parameter.
cmd.Parameters(1) = 11
cmd.Execute
%>
Calling via method 1<BR>
ReturnValue = <% Response.Write cmd.Parameters(0) %><P>
...
|
|
|

|
|
|
|
|
|
|
|
|
|