Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > .NET

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-29-2009, 02:08 PM
xnetdevph xnetdevph is offline
Registered User
 
Join Date: May 2005
Posts: 2
Exclamation Inconsistent value returned by Output Parameter

I've been running this scenario for a week and hardly find help on this unusual.

My code is running in C# language that interfaces with SQL 2005. I have a typical stored procedure that returns value based on the result of the execution. Using the SQLCommand, this value is obtained with the setting ParameterDirection to Output. For certain time, the program is running as expected. However, time comes that this variable suddenly returns a "null" value. The input parameters passed to this object is the same value as entered prior to this incident but suddenly it returns a "null" value.

The stored procedure being used is coded that should only send 1, -1 & -2. No zero & no null value were indicated on the code.

I tried to put try-catch & raiserror to be able to catch this error, however neither raise errors.

Need help desperately. Thanks.
Reply With Quote
  #2  
Old 10-29-2009, 02:51 PM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
Show me your stored procedure and what gets passed to it.

How long is "However, time comes"?
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista

Microsoft MVP 2005/2006/2007/2008/2009
Reply With Quote
  #3  
Old 10-29-2009, 03:56 PM
xnetdevph xnetdevph is offline
Registered User
 
Join Date: May 2005
Posts: 2
Unhappy

Here's my stored procedure. The "time comes" is unpredictable. The shortest that this anomaly appears is 40 seconds.



CREATE PROCEDURE [dbo].[spCheckValidWorkOrder]
@WORK_ORDER_NUMBER VARCHAR(50),
@RESULT_VALUE int OUTPUT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

declare @RESULT int

SET @RESULT = -2

-- Insert statements for procedure here
IF EXISTS(SELECT 1 FROM WORK_ORDERS WHERE WORK_ORDER_NUMBER = @WORK_ORDER_NUMBER)
BEGIN
SET @RESULT = 1
END
ELSE
BEGIN
SET @RESULT = -1
END

if @@ERROR <> 0
BEGIN
RAISERROR('Error encountered in spCheckValidWorkOrder',10,1)
END

--return @RESULT
SET @RESULT_VALUE = @RESULT

END



Quote:
Originally Posted by Hack View Post
Show me your stored procedure and what gets passed to it.

How long is "However, time comes"?
Reply With Quote
Reply

Bookmarks

Tags
output parameter, return value, sqlcommand, sqlparameter

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Stored Procedure Output parameter issue using esql/c Darkrider C++ 1 04-24-2008 07:03 AM
ADO VC++ How to get the output parameter from stored procedure as "table of record" Yazilim Database 2 11-22-2006 06:18 PM
Stored Procedure Output parameter issue using esql/c Darkrider Database 0 11-28-2005 01:56 PM
select query into an output parameter jak Database 2 12-20-2001 08:31 AM
Output Parameter Problem Brian LaBrake VB Classic 0 07-09-2001 02:53 PM


All times are GMT -4. The time now is 12:55 AM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.