title: How to display images in datalist from database?
body: <p>I have a datalist with an image control whose aspx code is</p>
  
  <pre><code>    &lt;asp:DataList ID="DataList1" runat="server" 
          RepeatDirection="Horizontal" RepeatColumns="4"&gt;
              &lt;ItemTemplate&gt;
                  &lt;div&gt;
                      &lt;asp:Image ID="Image1" ImageUrl='&lt;%#Eval("IMAGE") %&gt;' 
                       runat="server" Height="75px" Width="75px" /&gt;
                  &lt;/div&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:DataList&gt;
  </code></pre>
  
  <p>The code that I'm trying to get images from the database is</p>
  
  <pre><code>    PagedDataSource objds = new PagedDataSource();
          string query = "SELECT * FROM Icon";
          SqlConnection con = new SqlConnection();
          con.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ICONBANKConnectionString"].ConnectionString;
          try
          {
              SqlCommand cmd = new SqlCommand(query, con);
              con.Open();
              //SqlDataReader dr = cmd.ExecuteReader();
              SqlDataAdapter da = new SqlDataAdapter();
              da.SelectCommand = new SqlCommand(query, con);
              DataSet ds = new DataSet();
              da.Fill(ds, "images");
              objds.DataSource = ds.Tables[0].DefaultView;
  
              DataList1.DataSource = objds;
              DataList1.DataBind();
              con.Close();
          }
          catch (Exception)
          {
  
              throw;
          }
  </code></pre>
  
  <p>the sql table looks like this</p>
  
  <pre><code>    Icon( ID, SUBCAT_ID, ALBUM_ID, SUBCAT_NAME, ALBUM_NAME, IMAGE, ICON_SIZE, 
      BLACKWHITE, NAME, DESIGNER, HITS, RATINGS, PRICE)
  </code></pre>
  
  <p>When I debug the code it shows the table rows in dataset but when I run the page it is not showing me the image.... Kindly guide me what is the problem behind it. One More thing the image was stored in database is in binary format</p>