Display an image from a database
<p>I have a simple database where i have book information stored in it. 2 Fiction books and 2 category books..</p>

<p>For example: a technical book; name, description, isbn, author,publication,price,image </p>

<p>In the database i am not storing the actually image the image row just has the name of the image. for example cprog.jpeg i think in index 8</p>

<p>I have the image stored in the images file in the project.
Now, i am displaying the books in a div rather than a gridview. which is displaying fine, except i dont know how to do the image.</p>

<p>My question is how can i display the correct image from the database? Keep in mind i have several images.</p>

<pre><code>strBooksInCategory = "&lt;div&gt;";

            foreach (DataTable table in dsgrid2.Tables)
            {
                foreach (DataRow row in table.Rows)
                {
                    strBooksInCategory +=
                          "&lt;div style=\"height:150px;\"&gt;"  
                        + "  &lt;div style=\"border-style:solid;height:100px;width:100px;float:left;\"&gt; Image &lt;/div&gt;"
                        + "  &lt;div style=\"height:110px;float:left;padding-left:10px;\"&gt;"
                        + "   &lt;div style=\"height=auto;left-margin:10px;\"&gt;" + row[0] + "&lt;/div&gt;"
                        + "   &lt;div style=\"height=auto;left-margin:10px;\"&gt;" + row[1] + "&lt;/div&gt;"
                        + "   &lt;div style=\"height=auto;left-margin:10px;\"&gt;" + row[2] + "&lt;/div&gt;"
                        + "   &lt;div style=\"height=auto;left-margin:10px;\"&gt;" + row[3] + "&lt;/div&gt;"
                        + "   &lt;div style=\"height=auto;left-margin:10px;\"&gt;" + row[4] + "&lt;/div&gt;"
                        + "   &lt;div style=\"height=auto;left-margin:10px;\"&gt;" + row[5] + "&lt;/div&gt;"
                        + " &lt;/div&gt;"
                        + "&lt;/div&gt;";
                    strBooksInCategory += "&lt;div style=\"height:10px;width=100%;\"&gt;&lt;/div&gt;";
                    //foreach (DataColumn column in table.Columns)
                    //{
                    //    strBooksInCategory += "&lt;div style=\"border-style:solid;\"&gt;" + row[column] + "&lt;/div&gt;";
                    //}
                }
            }
            strBooksInCategory += "&lt;/div&gt;";
</code></pre>

<p>Here is my function on how i am retiriving the data from the database:</p>

<pre><code>private DataSet GetDataSet2()
    {
        // SQLiteConnection sqlite = new SQLiteConnection("Data Source=/path/to/file.db");
        //SQLiteConnection sqlite = new SQLiteConnection( "Data Source=" + Server.MapPath(@"~\App_Data\bookDB.db"));
        // SQLiteDataAdapter ad;

        string cid = Server.UrlDecode(Request.QueryString["Category"]);
        //string Cname = Request.QueryString["CategoryDescription"];
        lblCategory.Text = cid;
        DataSet ds2 = new DataSet();
        // this.TextBox1.Text = cid;

        String connectionString = "Data Source=" + Server.MapPath(@"~\App_Data\bookDB.db");
        String selectCommand = String.Format("Select * from Book where CategoryName = '{0}'", Request.QueryString);
        SQLiteConnection myConnection = new SQLiteConnection();
        myConnection.ConnectionString = connectionString;
        myConnection.Open();
        SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(selectCommand, myConnection);

        myConnection.Close();
        // DataSet ds = new DataSet();
        dataAdapter.Fill(ds2);
        return ds2;
    }
</code></pre>

<p>Here is what the page looks like so far using the above code to display my 2 books in div</p>

<p><img src="http://i.stack.imgur.com/hIVlC.png" alt="enter image description here"></p>
