This is a migrated thread and some comments may be shown as answers.

Get the return value?

2 Answers 72 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
julian Welby Everard
Top achievements
Rank 1
julian Welby Everard asked on 25 Sep 2010, 10:02 AM
Hi

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

2 Answers, 1 is accepted

Sort by
0
julian Welby Everard
Top achievements
Rank 1
answered on 28 Sep 2010, 09:19 AM
As no one seems to know the answer to this, I will have to reject the idea of using ORM to access my database, while eveything so far has been very good, the problem with not able to get the Return value from a stored procedure is a major one as a lot o f systems use this method to return status/error codes from stored procedures.

I do not want to rewrite over 10 different systems just to change the way i implment for a new one.

Julian
0
PetarP
Telerik team
answered on 28 Sep 2010, 02:28 PM
Hello julian Welby Everard,

 Currently there is no possible workaround to use the return value parameters. But since several more users have requested it we are implementing it right now. Once the implementation is ready you will be able to access the return parameters in a collection much like the out parameters.
We are sorry for any inconvenience this might be causing you.

Kind regards,
Petar
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
julian Welby Everard
Top achievements
Rank 1
Answers by
julian Welby Everard
Top achievements
Rank 1
PetarP
Telerik team
Share this question
or