title: How can I get return value of stored procedure when using SqlDataReader?
body: <p>Is it not possible to get the return value of a stored procedeure when using a datareader? The return value is always null, but the SP returns a valid int from within SSMS.</p>
  
  <pre><code>myCommand.CommandText = "GetVenueVideos";
  SqlParameter retVal = new SqlParameter("@returnValue",SqlDbType.Int);
  retVal.Direction = ParameterDirection.ReturnValue;
  myCommand.Parameters.Add(retVal);
  myReader = myCommand.ExecuteReader();
  if (myReader.Read() &amp;&amp; myReader.HasRows)
  {
      int returnValue = Convert.ToInt32(retVal.Value);
      //returnValue is null at this point
  }
  </code></pre>