473,699 Members | 2,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stored Procedure Output Parmeters

ASP Classic question:

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 is returned (iOrderID is assigned beforehand). The
rest of the output parameters come back blank:

cmdUpdate.Comma ndText = "myProcedur e"
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@RE TURN_VALUE",
adInteger, adParamReturnVa lue,0)
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@Or derID",
adInteger, adParamInput,, iOrderID)
cmdUpdate.Param eters.Append
cmdUpdate.Creat eParameter("@Fi rst",adVarChar, adParamOutput,8 0, sFirst)
cmdUpdate.Param eters.Append
cmdUpdate.Creat eParameter("@Se cond",adVarChar ,adParamOutput, 80, sSecond)
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@Th ird",
adVarChar, adParamOutput, 80, sThird)
set param =
cmdUpdate.Creat eParameter("@Am ount",adNumeric ,adParamOutput, 0, iAmount)
param.precision =18
param.numericsc ale=0
cmdUpdate.param eters.append param
cmdUpdate.Execu te ,,adexecutenore cords

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

cmdUpdate.Comma ndText = "myProcedur e"
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@RE TURN_VALUE",
adInteger, adParamReturnVa lue,0)
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@Or derID",
adInteger, adParamInput,, iOrderID)
cmdUpdate.Param eters.Append
cmdUpdate.Creat eParameter("@Fi rst",adVarChar, adParamOutput,8 0)
cmdUpdate.Param eters.Append
cmdUpdate.Creat eParameter("@Se cond",adVarChar ,adParamOutput, 80)
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@Th ird",
adVarChar, adParamOutput, 80)
set param =
cmdUpdate.Creat eParameter("@Am ount",adNumeric ,adParamOutput, 0)
param.precision =18
param.numericsc ale=0
cmdUpdate.param eters.append param
cmdUpdate.Execu te ,,adexecutenore cords

sFirst =cmdUpdate("@Fi rst")
sSecond=cmdUpda te("@Second")
sThird=cmdUpdat e("@Third")
iAmount=cmdUpda te("@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
Nov 18 '05 #1
2 2542
In the above samples, my input parameter is @OrderID, I changed it to @MyID
in the SQL for purpose of example, but not in real life--the sql & asp do
match. Also, when I say I can only retrieve one output parameter, I mean
@First comes back ok, but not @Second, @Third, or @Amount

"Bari Allen" <ba**@sos.REMOV ETHISNOSPAM.sta te.ga.us> wrote in message
news:eU******** ******@TK2MSFTN GP09.phx.gbl...
ASP Classic question:

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 is returned (iOrderID is assigned beforehand). The
rest of the output parameters come back blank:

cmdUpdate.Comma ndText = "myProcedur e"
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@RE TURN_VALUE",
adInteger, adParamReturnVa lue,0)
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@Or derID",
adInteger, adParamInput,, iOrderID)
cmdUpdate.Param eters.Append
cmdUpdate.Creat eParameter("@Fi rst",adVarChar, adParamOutput,8 0, sFirst)
cmdUpdate.Param eters.Append
cmdUpdate.Creat eParameter("@Se cond",adVarChar ,adParamOutput, 80, sSecond)
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@Th ird",
adVarChar, adParamOutput, 80, sThird)
set param =
cmdUpdate.Creat eParameter("@Am ount",adNumeric ,adParamOutput, 0, iAmount)
param.precision =18
param.numericsc ale=0
cmdUpdate.param eters.append param
cmdUpdate.Execu te ,,adexecutenore cords

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

cmdUpdate.Comma ndText = "myProcedur e"
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@RE TURN_VALUE",
adInteger, adParamReturnVa lue,0)
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@Or derID",
adInteger, adParamInput,, iOrderID)
cmdUpdate.Param eters.Append
cmdUpdate.Creat eParameter("@Fi rst",adVarChar, adParamOutput,8 0)
cmdUpdate.Param eters.Append
cmdUpdate.Creat eParameter("@Se cond",adVarChar ,adParamOutput, 80)
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@Th ird",
adVarChar, adParamOutput, 80)
set param =
cmdUpdate.Creat eParameter("@Am ount",adNumeric ,adParamOutput, 0)
param.precision =18
param.numericsc ale=0
cmdUpdate.param eters.append param
cmdUpdate.Execu te ,,adexecutenore cords

sFirst =cmdUpdate("@Fi rst")
sSecond=cmdUpda te("@Second")
sThird=cmdUpdat e("@Third")
iAmount=cmdUpda te("@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

Nov 18 '05 #2
Ask this question on the ASP Classic newsgroup:
microsoft.publi c.inetserver.as p.general.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"Bari Allen" <ba**@sos.REMOV ETHISNOSPAM.sta te.ga.us> wrote in message
news:eU******** ******@TK2MSFTN GP09.phx.gbl...
ASP Classic question:

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 is returned (iOrderID is assigned beforehand). The
rest of the output parameters come back blank:

cmdUpdate.Comma ndText = "myProcedur e"
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@RE TURN_VALUE",
adInteger, adParamReturnVa lue,0)
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@Or derID",
adInteger, adParamInput,, iOrderID)
cmdUpdate.Param eters.Append
cmdUpdate.Creat eParameter("@Fi rst",adVarChar, adParamOutput,8 0, sFirst)
cmdUpdate.Param eters.Append
cmdUpdate.Creat eParameter("@Se cond",adVarChar ,adParamOutput, 80, sSecond)
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@Th ird",
adVarChar, adParamOutput, 80, sThird)
set param =
cmdUpdate.Creat eParameter("@Am ount",adNumeric ,adParamOutput, 0, iAmount)
param.precision =18
param.numericsc ale=0
cmdUpdate.param eters.append param
cmdUpdate.Execu te ,,adexecutenore cords

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

cmdUpdate.Comma ndText = "myProcedur e"
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@RE TURN_VALUE",
adInteger, adParamReturnVa lue,0)
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@Or derID",
adInteger, adParamInput,, iOrderID)
cmdUpdate.Param eters.Append
cmdUpdate.Creat eParameter("@Fi rst",adVarChar, adParamOutput,8 0)
cmdUpdate.Param eters.Append
cmdUpdate.Creat eParameter("@Se cond",adVarChar ,adParamOutput, 80)
cmdUpdate.Param eters.Append cmdUpdate.Creat eParameter("@Th ird",
adVarChar, adParamOutput, 80)
set param =
cmdUpdate.Creat eParameter("@Am ount",adNumeric ,adParamOutput, 0)
param.precision =18
param.numericsc ale=0
cmdUpdate.param eters.append param
cmdUpdate.Execu te ,,adexecutenore cords

sFirst =cmdUpdate("@Fi rst")
sSecond=cmdUpda te("@Second")
sThird=cmdUpdat e("@Third")
iAmount=cmdUpda te("@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

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6579
by: Jarrod Morrison | last post by:
Hi all Im relatively new to using stored procedures and im not sure if it is possible to do what I am trying to do so any help here is greatly appreciated. I am using the variable @MachineName which is obviously the local machine name mainly in this procedure. What is loop through from the first character of the variable to the last and use this data in a select statement. I have included the code below for what I have tried so far but I...
0
6698
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft Visual Basic .NET version of this article, see 308049. For a Microsoft Visual C++ .NET version of this article, see 310071. For a Microsoft Visual J# .NET version of this article, see 320627. This article refers to the following Microsoft .NET...
4
8095
by: MD | last post by:
I am trying to create a dynamic SQL statement to create a view. I have a stored procedure, which based on the parameters passed calls different stored procedures. Each of this sub stored procedure creates a string of custom SQL statement and returns this string back to the main stored procedure. This SQL statements work fine on there own. The SQL returned from the sub stored procedure are returned fine. The datatype of the variable that...
4
1809
by: erich93063 | last post by:
I have a stored procedure which is performing a search against a "task" table. I would like to pass in a variable called @strAssignedTo which will be a comma delimeted list of employee ID's ie: "5,6,10". So my SQL without this variable would be something like: WHERE intAssignedTo IN (5,6,10) but when I try to do: WHERE intAssignedTo IN (@strAssignedTo)
2
5451
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
9
4137
by: fniles | last post by:
I am using VB.NET 2003 and SQL2000 database. I have a stored procedure called "INSERT_INTO_MYTABLE" that accepts 1 parameter (varchar(10)) and returns the identity column value from that table. When calling the stored procedure from VB.NET, in the CommandText, can I just say "INSERT_INTO_MYTABLE '12345'" instead of calling it with "INSERT_INTO_MYTABLE" then do the following : OleDbCommand2.Parameters.Add("@Account", SqlDbType.VarChar, 10)...
1
3339
by: jobs | last post by:
I have a growning list of stored procedures that accept a single string as a parameter. The list and parameters are maintained in a table with two columns. Some of the Stored procedures take hours to complete. procedures and the page come right back and recording infomation about the stored procedure (like a job number) that can later be used to report what stored procedures are still running.
2
6384
by: Krij | last post by:
Hi, I'm a student and I have the following working example that troubles me (in SQL Server 2005): CREATE PROCEDURE dbo.CustomersOrderHistory ( @Firstname varchar(7) OUTPUT) AS SELECT dbo.Customers.Firstname, dbo.Orders.Orderdate, dbo.Orderdetails.Orderamount, dbo.Orderdetails.Orderprice,
2
4101
by: jed | last post by:
I have created this example in sqlexpress ALTER PROCEDURE . @annualtax FLOAT AS BEGIN SELECT begin1,end1,deductedamount,pecentageextra FROM tax
0
8613
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8908
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8880
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6532
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4374
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.