retrieve varbinary using StoredProc with OUTPUT
Hi
I have a stored proc with a varbinary OUTPUT param and I am trying to retrieve the value of this variable in the C# using SqlCommand and setting its parameters. However, I am not able to retrieve the value of varbinary variable in C# for some unknown reasons. I would really appreciate your help. Thanks
Alvin
Byte [] testBinary = new Byte[100];
SqlParameter param1 = SqlCommand,Parameters.Add("@testBinary", SqlDBType.Binary, 100);
param1.value = testBinary
SqlCommand.CommandType = CommandType.StoredProcedure
SqlCommand.Direction = ParameterDirection.Output
SqlCommand.ExecureNonQuery()
Console.Writeline("Output param is {0}", Convert.ToBase64(testBinary)); ====> Don't see the value from Stored Proc
StoredProc
CREATE PROCEDURE test
testBinary (100) OUTPUT
AS
BEGIN
select @testBinary = testbin from testTable
END
|