R – SubSonic: retrieving value of stored procedure OUT parameters

out-parametersstored-proceduressubsonic

I love your tool. I have been using it a lot, but just today I ran into a problem…

I wrote a stored procedure that returns some values via OUT parameters, but SubSonic does not seem to generate the out parametes of the stored procedure method. For example, for SPI like this:

CREATE PROC dbo.MyProc @param1 int, @param2 int out, @param3 varchar(150) out

It generates signature

SPs.MyProc(int? param1, int? param2, string param3

I would expect it to generate this

SPs.MyProc(int? param1, out int? param2, out string param3)

Well, considering that the method actually just configures the SP and does not actually execute it, I woiuld expect Subsonic to generate this

SPs.MyProc(int? param1, ref int? param2, ref string param3)

How do you guys solve this problem? Is there something like that in Subsonic already and I just missed it?

Best Answer

SOURCE You can acess OuPut parametes of SP in SubSonic using StoredProcedure.OutputValues;

Folowing is the chunk of code to access OutPut parameters of SP, here i have sued SP “UspTestOutPut”:

StoredProcedure s = SPs.UspTestOutPut(”10″, “15″);
s.Execute();
s.OutputValues.ForEach(delegate(object objOutput)
{
    Response.Write(”OutPutValues=”+objOutput.ToString());
});