473,804 Members | 3,031 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get the output parameter from Store Procedure ?

I try to set an output parameter to get the result from store procedure,
However,Do I still need to loop the reader to get result ?? Thanks a lot

cmdKey.Paramete rs("@result").D irection = ParameterDirect ion.Output

Dim drCntrId As SqlDataReader =
cmdKey.ExecuteR eader(CommandBe havior.SingleRo w)
While drCntrId.Read
strKey = drCntrId.Item(" result")
End While

Nov 21 '05 #1
1 1380
Output params are not available until the data reader is closed. So, close
the drCntrlId first and then access the output value as
cmdKey.Paramete rs("@result").V alue

You can use SqlCommand.Exec uteNonQuery() instead of ExecuteReader unless you
return rows from the stored proc.

HTH

"Agnes" <ag***@dynamict ech.com.hk> wrote in message
news:e9******** ******@TK2MSFTN GP15.phx.gbl...
I try to set an output parameter to get the result from store procedure,
However,Do I still need to loop the reader to get result ?? Thanks a lot

cmdKey.Paramete rs("@result").D irection = ParameterDirect ion.Output

Dim drCntrId As SqlDataReader =
cmdKey.ExecuteR eader(CommandBe havior.SingleRo w)
While drCntrId.Read
strKey = drCntrId.Item(" result")
End While


Nov 21 '05 #2

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

Similar topics

5
6048
by: vivienne.netherwood | last post by:
I am developing an Access Project front end with a SQL server database. I have written a stored procedure that returns a record set and also a value via an output parameter. The procedure is as follows CREATE PROCEDURE qslCheckShiftTimes @Ward NVARCHAR(6), @Shift NVARCHAR(10), @Exists TINYINT OUTPUT AS
8
14024
by: Yusuf INCEKARA | last post by:
I have a stored procedure : CREATE PROCEDURE STP_GETSTORELIST @RETCUR CURSOR VARYING OUTPUT AS set @RETCUR = CURSOR FORWARD_ONLY STATIC FOR SELECT ID,STORE_NAME FROM T_INF_STORE ORDER BY STORE_NAME OPEN @RETCUR
8
4458
by: Christopher Weaver | last post by:
I'm having trouble accessing the value of an output parameter of a stored procedure. The SP looks like this: SET TERM ^ ; CREATE PROCEDURE SP_NEW_TASK RETURNS ( "uidTask" INTEGER) AS begin
2
2546
by: Bari Allen | last post by:
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
4
50418
by: Mr Not So Know It All | last post by:
im new to SQL Server and ASP.Net. Here's my problem. I have this SQL Server stored procedure with an input parameter and output parameter CREATE PROCEDURE . @in_rc varchar(8) @out_eList varchar(7) output AS select @out_eList = ecuid from _organization where rccode = @in_rc GO
6
2736
by: c676228 | last post by:
Hi everyone, I wrote a store procedure that fetch one row data in the database based on the parameter value I entered. After I created the store procedure, the store procedure code looks like this: ALTER proc getProductCommScale @product As varchar(30), @TISCommRate As Decimal(5,2) OUTPUT, @BrokerCommRate As Decimal(5,2) OUTPUT, @Fee As Decimal(5,2) OUTPUT As if RTRIM(@product)='Imed' Select @TISCommRate=TISComm,...
4
3394
by: Clint Pidlubny | last post by:
Hello, I'm using ASP.Net 2.0 and the Jan 2006 Enterprise Library. What I'm doing is passing an ArrayList into a stroed procedure to do an Insert. Here's some code: Dim params as New ArrarList params.Add("first parameter value") params.Add("second parameter value")
1
1797
hariharanmca
by: hariharanmca | last post by:
CREATE PROCEDURE sp_Insert_Prev_Date ( @pCurDate smalldatetime, @pFlgPrvDate integer, @pOutDate smalldatetime output ) as declare @recCount integer, @recCount1 integer begin set @recCount = (select isnull(count(*),0) from tblTime_Setings)
1
2026
by: Mike P | last post by:
I am trying to return an output parameter to my code on executing a stored procedure. In Query Analyzer, it works with no problem, but when I run my ASP code below, the output parameter never seems to return anything. Can anybody help? Dim cmdNewCampaign, rsNewCampaign, intNumber Const adCmdStoredProc = &H0004 Const adParamInput = &H0001 Const adParamOutput = &H0002 Const adVarChar = 200
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9575
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
10320
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
10308
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
10073
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...
0
9134
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6846
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
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3806
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.