New Posts New Posts RSS Feed: Stored Procedure with output parameter?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Stored Procedure with output parameter?

 Post Reply Post Reply
Author
katit View Drop Down
Senior Member
Senior Member


Joined: 09-Sep-2011
Posts: 146
Post Options Post Options   Quote katit Quote  Post ReplyReply Direct Link To This Post Topic: Stored Procedure with output parameter?
    Posted: 17-Jan-2012 at 6:57pm
Is that supported? This is code I have (what I found in documentation) but seems like I can't get parameter out. Right? What choices do I have?
 
public INotifyCompleted GetNextTripNumber(Action<int> onSuccess = null, Action<Exception> onFail = null)
        {
            int? nextTripNumber = 0;
            var query = this.EntityManager.SYSGetNextNumberQuery("MobileTrip", nextTripNumber);
            var entityQueryOperation = this.EntityManager.ExecuteQueryAsync(query);
            entityQueryOperation.Completed += (s, args) =>
            {
                if (args.CompletedSuccessfully)
                {
                    onSuccess(nextTripNumber.Value);
                }
                else
                {
                    args.MarkErrorAsHandled();
                    onFail(args.Error);
                }
            };
            return entityQueryOperation;
        }


Edited by katit - 17-Jan-2012 at 6:58pm
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 18-Jan-2012 at 12:52pm
Hi katit,

StoredProcs with out parms is supported starting version 6.1.2. See the following release notes for more details. Look for F1703.


To access the output parameters when doing async query, use StoredProcQuery.Parameters list. So in your case, it will be something like this.

            StoredProcQuery query = this.EntityManager.SYSGetNextNumberQuery("MobileTrip", nextTripNumber);
            var entityQueryOperation = this.EntityManager.ExecuteQueryAsync(query);
            entityQueryOperation.Completed += (s, args) =>
            {
                if (args.CompletedSuccessfully)
                {
    nextTripNumber = query.Parameters[1].Value;
                    onSuccess(nextTripNumber.Value);
                }
                else
                {
                    args.MarkErrorAsHandled();
                    onFail(args.Error);
                }
            };


Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down