title: Memory Stream convert to Byte
body: <p>I'm retrieving image from DB using Stream. Need someone to help me to convert to byte. 
  My code.    </p>
  
  <pre><code>//connection.Open();
  
  string sql = "SELECT Photo FROM ImageTable WHERE TagId = @ID";
  
  SqlCommand cmd = new SqlCommand(sql, connection);
  cmd.CommandType = CommandType.Text;
  cmd.Parameters.AddWithValue("@ID", tagid);
  
  connection.Open();
  
  object img = cmd.ExecuteScalar();
  
  try
  {
      return new MemoryStream((byte[])img);
  }
  catch
  {
      return null;
  }
  </code></pre>
  
  <p>before I return I need to change to byte. Someone please help.</p>