Click here to Skip to main content
11,790,021 members (49,245 online)
Rate this: bad
Please Sign up or sign in to vote.
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
Edited 18-Feb-13 19:17pm
Nandakishorerao at 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 at 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 at 19-Feb-13 1:20am
one question is there....

You have stored image bytes or image path in database...?
Mr. Mahesh Patel at 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 at 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
0 OriginalGriff 1,029
1 Maciej Los 790
2 KrunalRohit 686
3 CPallini 606
4 Richard MacCutchan 460

Advertise | Privacy | Mobile
Web01 | 2.8.1509028.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2015
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