public System.IO.Stream GetBinaryStreamByUrl(string url)
        {
            SqlReaderStream stream = null;

            using (SqlConnection cn = new SqlConnection(ConnectionString))
            {
                SqlCommand cmd = new SqlCommand(SqlQuery, cn);
                cmd.Parameters.Add("@url", SqlDbType.VarChar, 255); // note: the length of the URL parameter must equal the length of the BINARY_VARIANT.PATH column in the broker database
                cmd.Parameters["@url"].Value = url;
                cn.Open();
                //CommandBehavior.SequentialAccess avoids loading the entire BLOB in-memory.
                SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess);
                if (false == reader.Read())
                {
                    reader.Dispose();
                    return(null);
                }
                stream = new SqlReaderStream(reader, 0);
            }
            return(stream);
        }
 public System.IO.Stream GetBinaryStreamByUrl(string url)
 {
     SqlReaderStream stream = null;
     using (SqlConnection cn = new SqlConnection(ConnectionString))
     {
         SqlCommand cmd = new SqlCommand(SqlQuery, cn);
         cmd.Parameters.Add("@url", SqlDbType.VarChar, 255); // note: the length of the URL parameter must equal the length of the BINARY_VARIANT.PATH column in the broker database
         cmd.Parameters["@url"].Value = url;
         cn.Open();
         //CommandBehavior.SequentialAccess avoids loading the entire BLOB in-memory.
         SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess);
         if (false == reader.Read())
         {
             reader.Dispose();
             return null;
         }
         stream = new SqlReaderStream(reader, 0);
     }
     return stream;
 }