DataReader DIES on Image column
I have a stored procedure - written like all the other working stored procedures. What makes this stored procedure unique is that it is returning a single image from an SQL Server 2005 column of type Image.
I'm using the same code (Visual Studio 2005 VB.NET) that works for retrieving output parameters like UniqueIdentifiers and Varchars.
But when it comes time for Sqldatareader to execute on an Image it throws up this error message:
'Byte[] [2]: the Size property has an invalid size of 0'
Here is the relevant code
cmdGet = New SqlClient.SqlCommand("getItemImage", cn)
...
cmdGet.CommandType = CommandType.StoredProcedure
...
cmdGet.Parameters.Add("@LibraryItemID", SqlDbType.UniqueIdentifier).Direction = ParameterDirection.Input
cmdGet.Parameters.Add("@ImageTypeID", SqlDbType.UniqueIdentifier).Direction = ParameterDirection.Input
cmdGet.Parameters.Add("@ItemImage", SqlDbType.Image).Direction = ParameterDirection.Output
...
Dim reader As SqlDataReader
reader = cmdGet.ExecuteReader(CommandBehavior.SequentialAccess) -> this is where it dies
Can anybody please resusitate this sorry code-situation?
Peter

