No data retrieved while calling a stored procedure
<p>I am trying to call a stored procedure from VC++.</p>

<p>Here is what the stored procedure looks like:</p>

<pre><code>public static void SqlStoredProcedure2(string name, out byte[] backup)
{
    using (SqlConnection conn = new SqlConnection("context connection=true"))
    {
        SqlCommand cmd = new SqlCommand();
        cmd.Connection = conn;
        conn.Open();
        cmd.CommandText = "SELECT EmployeePhoto FROM [dbo].[DimEmployee] where FirstName like '%@name%'";
        SqlDataReader reader = null;
        reader = cmd.ExecuteReader();
        backup = null;
        while (reader.Read())
        {
            backup = (byte[])reader["EmployeePhoto"];
        }
        conn.Close();
    }
}
</code></pre>

<p>And the c++ code looks like:</p>

<pre><code>RETCODE retcode = SQLAllocHandle(SQL_HANDLE_STMT,hdbc,&amp;hstmt);
retcode = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 5, 0, "Alan", 0, &amp;cbParm1);
unsigned char ptr[8000] = "";
cbParm2 = 8000;
retcode = SQLBindParameter(hstmt, 2, SQL_PARAM_OUTPUT, SQL_C_BINARY, SQL_VARBINARY, 0, 0, ptr, 0, &amp;cbParm2);
retcode = SQLExecDirectA(hstmt, (UCHAR*)"{call SqlStoredProcedure2(?, ?)}", SQL_NTS);
</code></pre>

<p>There is no error when I check returned code but nothing comes in <code>ptr</code>? What is wrong here?</p>
