|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
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 |
|
#3
|
|||
|
|||
|
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 |
![]() |
| Bookmarks |
| Tags |
| output parameter, return value, sqlcommand, sqlparameter |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
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 |