1

In C#, using the NPoco (v3.4.3), I'm trying to invoke a MySQL procedure that returns both a result set and an OUT parameter...

CREATE PROCEDURE MyProc(IN itemId INT, OUT returnCode INT)
BEGIN
    ...
    SET returnCode = -2;
    ...
    select * from MyTable where id = itemId;
END

I really have no clue where to start. I have found some petapoco examples but they seem to be SQL Server specific (making use of SqlParameter). There must be some noon-database specific way to accomplish this with NPoco that works with MySQL.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Tony
  • 1,986
  • 2
  • 25
  • 36
  • boy good luck with those tags on an intersect for this one :p Maybe you can make use of this [Answer](http://stackoverflow.com/a/38706288) of mine. Returning a resultset is a trivial part which was not part of the exercise over there. – Drew Oct 10 '16 at 17:56
  • @Drew understood. We have sort of worked around it for now (we returned two resultsets), but I'm sure there is a way, but I can't figure it out. – Tony Oct 10 '16 at 18:21
  • 1
    Have you tried: `CALL MyProc(@1, @2); SELECT @2;` – MB34 Nov 03 '16 at 22:02
  • Did you solve this? – Konrad Mar 06 '19 at 12:51
  • https://stackoverflow.com/questions/8612167/petapoco-and-output-parameters-from-stored-procedures – Konrad Mar 07 '19 at 13:56
  • Worked for me (npoco is petapoco fork) – Konrad Mar 07 '19 at 13:56

0 Answers0