Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling a Stored Procedure with Output Parameter
Message
From
25/06/2010 18:10:46
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01470620
Message ID:
01470643
Views:
22
>>The CreateParameter method takes care of that for you. If you pass in a string it will be a string. If you pass in a zero it will be an integer. The length gets set also. I just tested and with a string of "00" the length gets set to 2.
>>Tim
>>
>
>Ok, I'm also guessing you have overloads to pass length and type explicitly, right?
>

No, but overload to pass in parameter type and the direction. The length seems to be dynamic. I just tested it using a length of 10 but when it came back it was length of 1 because the value was 0.

The problem seems to be the stored procedure because I can clearly see the parameter after the execution and it is named. The value is "0" so the stored procedure does not set the value of the parameter correctly. Here is the one I was using for a test.
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[GetNextNumber] 
	@NextNumber varchar(10) Output
AS
BEGIN
	SET NOCOUNT ON;

   Set @NextNumber = '0000001045'
END
What could be missing from the stored procedure?
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform