I am calling a stored procedure from my Java script app and trying to use
the returned value later on in my app.
Here is the javascript code.
var connObj = Server.CreateObject("ADODB.connection");
connObj.Open("DRIVER={ SQL Server }; SERVER = 9.1.2.1;
DATABASE=TEST","sa","xyz");
var recordSetObj = Server.CreateObject("ADODB.Recordset");
var StrName = "venkat";
var RetVal;
var query = "Exec ProcSP '"+StrName+'", '"+RetVal+"'";
recordSetObj.Open(query,connObj);
Response.Write("Return Value= "+RetVal);
/******Stored Procedure********/
Create Procedure ProcSP
@.StrName nvarchar(10),
@.RetVal integer OUTPUT
AS
SET RetVal = 1
return
GO
The value returned is empty, even if I initialize RetVal to 2 say before the
call of Store procedure then once the execution of stored procedure is
finished it prints as 2 only. It is not getting changed to 1.
Please note the stored procedure is working fine if i execute any queries, i
mean the stored procedure is getting called from the app and is working
properly the only thing is i am not able to return any value from it.
I greatly appreciate anyhelp on this, i need to fix this issue ASAP, i am
running short of time. Please help me.
Regards,
VenkatHave you tried using parameters and the command object?
That's typically how you retrieve the values of output
parameters and return values in ADO.
-Sue
On Fri, 28 Nov 2003 11:09:31 +0530, "Venkat"
<venkat_kp@.yahoo.com> wrote:
quote:
>Hi,
>I am calling a stored procedure from my Java script app and trying to use
>the returned value later on in my app.
>Here is the javascript code.
>var connObj = Server.CreateObject("ADODB.connection");
>connObj.Open("DRIVER={ SQL Server }; SERVER = 9.1.2.1;
>DATABASE=TEST","sa","xyz");
>var recordSetObj = Server.CreateObject("ADODB.Recordset");
>var StrName = "venkat";
>var RetVal;
>var query = "Exec ProcSP '"+StrName+'", '"+RetVal+"'";
>recordSetObj.Open(query,connObj);
>Response.Write("Return Value= "+RetVal);
>
>/******Stored Procedure********/
>Create Procedure ProcSP
>@.StrName nvarchar(10),
>@.RetVal integer OUTPUT
>AS
>SET RetVal = 1
>return
>GO
>
>The value returned is empty, even if I initialize RetVal to 2 say before th
e
>call of Store procedure then once the execution of stored procedure is
>finished it prints as 2 only. It is not getting changed to 1.
>Please note the stored procedure is working fine if i execute any queries,
i
>mean the stored procedure is getting called from the app and is working
>properly the only thing is i am not able to return any value from it.
>
>I greatly appreciate anyhelp on this, i need to fix this issue ASAP, i am
>running short of time. Please help me.
>
>Regards,
>Venkat
>
>
>
No comments:
Post a Comment