keyongtech


  keyongtech > inetserver.* > inetserver.asp.general > 09/2004

 #1  
09-17-04, 08:32 PM
Bari Allen
I have a Stored procedure in SQL, that works, when tested in SQL, with one
input & several output parameters, as follows:
CREATE PROCEDURE myProcedure
@MyID int
, @First varchar(80) OUTPUT
, @Second varchar(80) OUTPUT
, @Third varchar(80) OUTPUT
, @Amount as numeric(18,0) OUTPUT
etc.

In ASP, however, using the following, the procedure executes it's internal
update function properly & sends back a return code of 0, however, only the
first output parameter (sFirst) is returned (Input Parameter MyID is
assigned beforehand). The rest of the output parameters come back blank:

cmdUpdate.CommandText = "myProcedure"
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@RETURN_VALUE",
adInteger, adParamReturnValue,0)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@OrderID",
adInteger, adParamInput,, MyID)
cmdUpdate.Parameters.Append
cmdUpdate.CreateParameter("@First",adVarChar,adPar amOutput,80, sFirst)
cmdUpdate.Parameters.Append
cmdUpdate.CreateParameter("@Second",adVarChar,adPa ramOutput,80, sSecond)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@Third",
adVarChar, adParamOutput, 80, sThird)
set param =
cmdUpdate.CreateParameter("@Amount",adNumeric,adPa ramOutput,0, iAmount)
param.precision=18
param.numericscale=0
cmdUpdate.parameters.append param
cmdUpdate.Execute ,,adexecutenorecords

I have also tried retrieving/assigning the values after execution, as
follows, but to no avail:

cmdUpdate.CommandText = "myProcedure"
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@RETURN_VALUE",
adInteger, adParamReturnValue,0)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@OrderID",
adInteger, adParamInput,, MyID)
cmdUpdate.Parameters.Append
cmdUpdate.CreateParameter("@First",adVarChar,adPar amOutput,80)
cmdUpdate.Parameters.Append
cmdUpdate.CreateParameter("@Second",adVarChar,adPa ramOutput,80)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@Third",
adVarChar, adParamOutput, 80)
set param =
cmdUpdate.CreateParameter("@Amount",adNumeric,adPa ramOutput,0)
param.precision=18
param.numericscale=0
cmdUpdate.parameters.append param
cmdUpdate.Execute ,,adexecutenorecords

sFirst =cmdUpdate("@First")
sSecond=cmdUpdate("@Second")
sThird=cmdUpdate("@Third")
iAmount=cmdUpdate("@Amount")

Is there some kind of limitation in ASP that you can only retrieve one
output parameter from a stored procedure? If not, how do I rectify this?
Thanks in advance.

Bari
 #2  
09-17-04, 08:48 PM
Bob Barrows [MVP]
Bari Allen wrote:
> I have a Stored procedure in SQL, that works, when tested in SQL,
> with one input & several output parameters, as follows:
> CREATE PROCEDURE myProcedure
> @MyID int
> , @First varchar(80) OUTPUT
> , @Second varchar(80) OUTPUT
> , @Third varchar(80) OUTPUT
> , @Amount as numeric(18,0) OUTPUT
> etc.


Make sure you have a SET NOCONT ON statement at the beginning of the
procedure. Without this statement, the query will generate one or more "x
records were affected" messages and send them back to the clients as
resultsets. Since your ADO code never processes these resultsets, the output
parameter values are never sent. Use SET NOCOUNT ON to suppress these
messages.

Bob Barrows
Similar Threads
sqldatasource using a stored procedure with OUTPUT parameters only

I have a sqldatasource control that has SelectCommand set to StoredProcedure, and that stored procedure only returns OUTPUT parameters, it doesn't return a recordset. It has...

Stored Procedure with Output Parameters

Hi all I'm tryng to use MSDAORA access in a Oracle 9 database. I have a stored procedure named TEST with this Sign : PROCEDURE TEST ( PC_01 IN VARCHAR2 ,PC_02...

Using Stored Procedure at sqlDataAdapters with output parameters

declare @Count int select @Count = COUNT ( * ) FROM tblXUDUserShip select FirstName,SurName,@Count AS BankaSayisi FROM tblXUDUserShip I have a Stored Procedure Which...

Getting OUTPUT parameters from another stored procedure

OK, here is what I have. Proc1 defines some variables within it, say one is @Amount1 and @Amount2. (These are not parameters passed to proc1, they are variables within...

Output Parameters set by Stored procedure

HI, Trying to set a Global Variable using output from a stored procedure. I'm using a row value. The stored procedure variable is declared as varchar(200). The Global...


All times are GMT. The time now is 11:40 AM. | Privacy Policy