|
 |
aspx thread: Retrieving return code from stored procedure
Message #1 by "Jacques Leclerc" <jleclerc2@h...> on Wed, 8 Nov 2000 09:40:55 -0500
|
|
Looking for information on how to retrieve the return code from a stored
procedure. The stored procedure uses a parametized list containing both
input and output variables. There is no problem with the items declared as
input or output.
If I try to add, as the first item of the param list a variable to contain
the return code an error isreturned stating that too many variables are
being supplied to the stored procedure.
myCommand.Parameters.Add(New SQLParameter("Return_Value",
SQLDataType.Int, 4))
myCommand.Parameters.Add(New SQLParameter("@inCat", SQLDataType.VarChar,
Len(Category.Text)))
MyCommand.Parameters("@inCat").Direction = adParaminput
I've dug through the framework docs and cannot find anything relating to the
retrieving the return code from a stored procedure.
Can someone point me in the rightdirection.
Thanks
Jacques
Message #2 by "Terry Carr" <terry@r...> on Wed, 8 Nov 2000 13:32:33 -0500
|
|
Jacques,
To get a return value from a stored procedure you have to set it up
something like:
Dim parameterReviewID As SQLParameter = new
SQLParameter("@ReviewID", SQLDataType.Int, 4)
parameterReviewID.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterReviewID)
After opening and executing:
myConnection.Open()
myCommand.Execute()
The value of the return code will be in the Value property of the
SQLParameter:
parameterReviewID.Value
----- Original Message -----
From: "Jacques Leclerc" <jleclerc2@h...>
Newsgroups: aspx
To: "ASP+" <aspx@p...>
Sent: Wednesday, November 08, 2000 9:40 AM
Subject: [aspx] Retrieving return code from stored procedure
> Looking for information on how to retrieve the return code from a stored
> procedure. The stored procedure uses a parametized list containing both
> input and output variables. There is no problem with the items declared as
> input or output.
>
> If I try to add, as the first item of the param list a variable to contain
> the return code an error isreturned stating that too many variables are
> being supplied to the stored procedure.
>
> myCommand.Parameters.Add(New SQLParameter("Return_Value",
> SQLDataType.Int, 4))
> myCommand.Parameters.Add(New SQLParameter("@inCat",
SQLDataType.VarChar,
> Len(Category.Text)))
> MyCommand.Parameters("@inCat").Direction = adParaminput
>
> I've dug through the framework docs and cannot find anything relating to
the
> retrieving the return code from a stored procedure.
>
> Can someone point me in the rightdirection.
>
>
> Thanks
>
> Jacques
>
>
>
>
Message #3 by "Fredrik Normen" <fredrik.normen@e...> on Thu, 09 Nov 2000 07:55:15 +0100
|
|
In the NGWS SDK Documentation goto:
NGWS SDK Developers Guide >
Building NGWS Applications >
Accessing Data >
What Is ADO+ >
Working with DataSets >
Working With Managed Providers >
Input / OutPut Parameters and Return values
You can try this:
Dim myParam As SQLParameter = Nothing
myParam = myCommand.Parameters.Add(New SQLParameter("Return_Value",
SQLDataType.Int))
'Set direction for the parameter that should return
'a value to ReturnValue or change it to Ouput if there
'is a output parameter
myParam.Direction = ParameterDirection.ReturnValue
myParam = myCommand.Parameters.Add(New SQLParameter("@inCat",
SQLDataType.VarChar,Len(Category.Text)))
myParam.Direction = ParameterDirection.Input
myParam.Value = "Foo"
I hope this will help you
/Fredrik Normen
----- Original Message -----
From: "Jacques Leclerc" <jleclerc2@h...>
Date: Wednesday, November 8, 2000 3:40 pm
Subject: [aspx] Retrieving return code from stored procedure
> Looking for information on how to retrieve the return code from a
> storedprocedure. The stored procedure uses a parametized list
> containing both
> input and output variables. There is no problem with the items
> declared as
> input or output.
>
> If I try to add, as the first item of the param list a variable to
> containthe return code an error isreturned stating that too many
> variables are
> being supplied to the stored procedure.
>
> myCommand.Parameters.Add(New SQLParameter("Return_Value",
> SQLDataType.Int, 4))
> myCommand.Parameters.Add(New SQLParameter("@inCat",
> SQLDataType.VarChar,Len(Category.Text)))
> MyCommand.Parameters("@inCat").Direction = adParaminput
>
> I've dug through the framework docs and cannot find anything
> relating to the
> retrieving the return code from a stored procedure.
>
> Can someone point me in the rightdirection.
>
>
> Thanks
>
> Jacques
>
>
>
>
Message #4 by "Jacques Leclerc" <jleclerc2@h...> on Thu, 9 Nov 2000 08:30:58 -0500
|
|
Thanks,
Exactly what I was looking for. It solved the problem.
Jacques
"Fredrik Normen" <fredrik.normen@e...> wrote in message
news:19156@a...
>
> In the NGWS SDK Documentation goto:
>
> NGWS SDK Developers Guide >
> Building NGWS Applications >
> Accessing Data >
> What Is ADO+ >
> Working with DataSets >
> Working With Managed Providers >
> Input / OutPut Parameters and Return values
>
> You can try this:
>
> Dim myParam As SQLParameter = Nothing
> myParam = myCommand.Parameters.Add(New SQLParameter("Return_Value",
> SQLDataType.Int))
>
> 'Set direction for the parameter that should return
> 'a value to ReturnValue or change it to Ouput if there
> 'is a output parameter
> myParam.Direction = ParameterDirection.ReturnValue
>
> myParam = myCommand.Parameters.Add(New SQLParameter("@inCat",
> SQLDataType.VarChar,Len(Category.Text)))
> myParam.Direction = ParameterDirection.Input
> myParam.Value = "Foo"
>
>
> I hope this will help you
>
> /Fredrik Normen
>
>
> ----- Original Message -----
> From: "Jacques Leclerc" <jleclerc2@h...>
> Date: Wednesday, November 8, 2000 3:40 pm
> Subject: [aspx] Retrieving return code from stored procedure
>
> > Looking for information on how to retrieve the return code from a
> > storedprocedure. The stored procedure uses a parametized list
> > containing both
> > input and output variables. There is no problem with the items
> > declared as
> > input or output.
> >
> > If I try to add, as the first item of the param list a variable to
> > containthe return code an error isreturned stating that too many
> > variables are
> > being supplied to the stored procedure.
> >
> > myCommand.Parameters.Add(New SQLParameter("Return_Value",
> > SQLDataType.Int, 4))
> > myCommand.Parameters.Add(New SQLParameter("@inCat",
> > SQLDataType.VarChar,Len(Category.Text)))
> > MyCommand.Parameters("@inCat").Direction = adParaminput
> >
> > I've dug through the framework docs and cannot find anything
> > relating to the
> > retrieving the return code from a stored procedure.
> >
> > Can someone point me in the rightdirection.
> >
> >
> > Thanks
> >
> > Jacques
> >
> >
> >
> >
>
>
|
|
 |