Supplying output parameter to sqlparametercollection resulting in error (Varbinary)

Posted by dotnetdev on Stack Overflow See other posts from Stack Overflow or by dotnetdev
Published on 2010-06-14T09:59:40Z Indexed on 2010/06/14 10:02 UTC
Read the original article Hit count: 156

Filed under:

Hi,

I want to supply an output parameter to my stored proc. This output proc is returning byte[]. How do I do this? If I do the following:

            command.Parameters.Add(new SqlParameter("@Bytes", SqlDbType.VarBinary));
            command.Parameters[1].Direction = ParameterDirection.Output;

I get:

System.InvalidOperationException: Byte[][1]: the Size property has an invalid size of 0. This stored proc works fine in SQL Server when I execute it via the SSMS option "Execute Stored Procedure).

Any ideas? Thanks

© Stack Overflow or respective owner

Related posts about c#