Click here to Skip to main content
13,200,202 members (55,183 online)
Rate this:
Please Sign up or sign in to vote.
See more: , +
how to retrive image form database and show in image control in

i use this for retrive image

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["EatProject"].ToString());
        string str = "select Name,ImagePath,Link,Status from ImagesPath where ID ='" + DropDownList1.SelectedItem.Text + "'";
        cmd = new SqlCommand(str, con);
        dr = cmd.ExecuteReader();
        while (dr.Read())
            TextBox4.Text = dr["Name"].ToString();
            //Image1.ImageUrl = dr["Imagepath"].ToString();
            TextBox5.Text = dr["Link"].ToString();
            TextBox6.Text = dr["Status"].ToString();

but image is not show in image control
Posted 18-Feb-13 18:34pm
Updated 18-Feb-13 19:17pm
Nandakishorerao 19-Feb-13 1:34am
are you storing image path or path with the url..i.e, virtual path during development
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Hi Dear,
Please refer my previous post from below link

How to show images in image control which are all ready present in the database[^]
M@anish 19-Feb-13 1:12am
i want show image only in image control not in grideview control image retrieve from database please help me
Mr. Mahesh Patel 19-Feb-13 1:20am
one question is there....

You have stored image bytes or image path in database...?
Mr. Mahesh Patel 19-Feb-13 1:18am
ya, but you can reference this post, do not use complete. this is just guide my dear.
Mr. Mahesh Patel 19-Feb-13 1:19am
other wise you have to store image physically and give path to your image control.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171020.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100