This question is locked. New answers and comments are not allowed.
Hi
I have a simple stored procedure as follows :-
This i have cust down a bit, but in essence it takes a single parameter and returns a dataset and also sets a return code in this case its 10.
ORM generates the code below to call the stored procedure
I then call this and process each row returned
But how do I get the returned value as well, I could add it as a return outpout parameter, but the code is used by other systems and therefor I cant change the stored procedure definiation, in good old .net SQL classes i create the parameter as a 'Return' type and get it that way,
I just cant see how to do this in ORM, there seems to be a ParameterAttribute in the documentation nut no indication on how this is used
Julian
I have a simple stored procedure as follows :-
CREATE PROCEDURE SelectCar
@CarID Int = null
AS
BEGIN
SET NOCOUNT ON;
Select *
from Cars
where CarID = @CarID or @CarID is Null
return 10
END
GO
This i have cust down a bit, but in essence it takes a single parameter and returns a dataset and also sets a return code in this case its 10.
ORM generates the code below to call the stored procedure
Public Shared Function SelectCar(ByVal scope As IObjectScope,ByVal carID As Nullable(Of Integer)) As IQueryResult
Dim query As IQuery = scope.GetSqlQuery("[SelectCar] ?", Nothing, "INTEGER CarID")
Dim res As IQueryResult = query.Execute(New Object() {carID})
Dim count As Integer = res.Count 'executes the query
Return res
End Function
I then call this and process each row returned
Dim scope As IObjectScope = ObjectScopeProvider.GetNewObjectScope()
Dim result As IQueryResult = StoredProcedure.SelectCar(scope, Nothing)
For Each pr As Object() In result
Next
But how do I get the returned value as well, I could add it as a return outpout parameter, but the code is used by other systems and therefor I cant change the stored procedure definiation, in good old .net SQL classes i create the parameter as a 'Return' type and get it that way,
I just cant see how to do this in ORM, there seems to be a ParameterAttribute in the documentation nut no indication on how this is used
Julian