Re: Output & return parameters using SQLHelper from DAAB
From: Val Mazur (group51a_at_hotmail.com)
Date: 11/24/04
- Next message: SK: "Stored Procedure Syntax"
- Previous message: Val Mazur: "Re: Merging 2 datasets raises System.IndexOutOfRange exception"
- In reply to: JStemper: "Output & return parameters using SQLHelper from DAAB"
- Next in thread: JStemper: "Re: Output & return parameters using SQLHelper from DAAB"
- Reply: JStemper: "Re: Output & return parameters using SQLHelper from DAAB"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 23 Nov 2004 20:16:01 -0500
Hi,
Like for me code looks fine, but what happens with these parameters inside
of the SqlHelper class? Did you add them into the parameters collection of
the command, which executes them?
--
Val Mazur
Microsoft MVP
"JStemper" <JStemper@discussions.microsoft.com> wrote in message
news:ABA00DB5-D818-4E65-82EE-2340A26ECB74@microsoft.com...
> I'm having trouble getting the following code to return an output value
> and
> the return value from a stored proc. When the stored proc is run from
> Query
> Analyzer it returns both the output parameter and the return value. But
> when
> I use DAAB 2.x the values are both set to 0 which are not the correct
> values.
>
> TIA John
>
>
> _C# code _________________________________________________________
> SqlParameter paramEventLocationId = new SqlParameter
> ("@intEventLocationId",
> SqlDbType.Int );
> SqlParameter paramNewPaymentId = new SqlParameter ("@intNewPaymentID",
> SqlDbType.Int, 4 );
> SqlParameter paramReturn = new SqlParameter ("@intError", SqlDbType.Int );
>
> paramReturn.Direction = ParameterDirection.ReturnValue;
> paramNewPaymentId.Direction = ParameterDirection.Output;
>
> paramEventLocationId.Value = 361;
>
> try
> {
> SqlHelper.ExecuteScalar(
> CONN_STRING,
> spName,
> paramEventLocationId,
> paramNewPaymentId
> );
> }
> catch (Exception ex)
> {
> ExceptionManager.Publish(ex);
> }
> int temp = Convert.ToInt32(paramReturn.Value);
> int lOrderNumber= Convert.ToInt16(paramNewPaymentId.Value);
>
> _____End Code ____________________________________________
>
- Next message: SK: "Stored Procedure Syntax"
- Previous message: Val Mazur: "Re: Merging 2 datasets raises System.IndexOutOfRange exception"
- In reply to: JStemper: "Output & return parameters using SQLHelper from DAAB"
- Next in thread: JStemper: "Re: Output & return parameters using SQLHelper from DAAB"
- Reply: JStemper: "Re: Output & return parameters using SQLHelper from DAAB"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|