Invalid code generated for ourput parameters

Posts   
 
    
bjones
User
Posts: 22
Joined: 13-Feb-2004
# Posted on: 26-Apr-2007 23:36:44   

The following code is being generated to execute an action procedure:

declare @p2 varchar(100) set @p2=default exec [Get_Benefits].[dbo].[usp_DeleteCharge] @CHARGE_ID=25403,@MESSAGE=@p2 output select @p2

The problem is with the second line, it generates a SQL error:

Server: Msg 156, Level 15, State 1, Line 2 Incorrect syntax near the keyword 'default'.

This is happening with both SQLserver 2000 and 2005. LLBLGen release is 1.0.2005.1 with active server pages.

Is there a way around this? confused

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 27-Apr-2007 09:26:21   

Which runtime library version are you using?

Also would you please post the code you use to call the SP?

bjones
User
Posts: 22
Joined: 13-Feb-2004
# Posted on: 27-Apr-2007 18:45:52   

Here is the call: "ActionProcedures.Usp_DeleteCharge(Val(Me.hdn_ChargeId.Value), str_Message)"

@Message is an INPUT/OUTPUT parameter, and that's what is trying to be set to "default".

The SQLServer runtime library version is 1.0.20051.60111

The sproc does not have any default parameters, it is defined as:

CREATE PROCEDURE usp_DeleteCharge (@CHARGE_ID INT, @MESSAGE VARCHAR(100) OUTPUT) AS SET NOCOUNT ON

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 28-Apr-2007 05:45:34   

Please update to the latest runtime libraries.

David Elizondo | LLBLGen Support Team
bjones
User
Posts: 22
Joined: 13-Feb-2004
# Posted on: 30-Apr-2007 19:00:39   

Ok, I now running with the new runtime libraries date 4/17/2007. I'm still getting the same generated code :

declare @p2 varchar(100) set @p2=default exec [Get_Benefits].[dbo].[usp_DeleteDeposit] @PAYMENT_ID=36104,@MESSAGE=@p2 output select @p2

I have recompiled the application to use the new libraries. disappointed

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 01-May-2007 09:59:11   

Since Message is an output parameter then I think you might need to pass it by Ref:

ActionProcedures.Usp_DeleteCharge(Val(Me.hdn_ChargeId.Value), ref str_Message)
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39918
Joined: 17-Aug-2003
# Posted on: 01-May-2007 11:10:15   

That's actually .NET's code. We just call ExecuteNonQuery and specify it's a proc, so the SqlClient emits that SQL. I also think the 'ref' should be used.

Frans Bouma | Lead developer LLBLGen Pro
bjones
User
Posts: 22
Joined: 13-Feb-2004
# Posted on: 03-May-2007 18:25:27   

It appears that the only way around this is to actually assign default values to an OUTPUT parameter in sprocs. Then the code works.

This is a gotcha for people upgrading from 1.0.2003.1 to 1.0.2005.1.

I now have 40-50 sprocs to update cry

BTW: All of the references to the @MESSAGE parameter were already "by ref" according to intellisense.