Click here to Skip to main content
12,405,700 members (59,720 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: SQL-server-2005 ASP.NET , +
how to retrive image form database and show in image control in asp.net


i use this for retrive image


SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["EatProject"].ToString());
 
        con.Open();
        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();
           
        }
        con.Close();


but image is not show in image control
Posted 18-Feb-13 18:34pm
M@anish1.3K
Updated 18-Feb-13 19:17pm
v2
Comments
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
 
good
Please Sign up or sign in to vote.

Solution 3

  Permalink  
Rate this: bad
 
good
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[^]
  Permalink  
Comments
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 | Mobile
Web01 | 2.8.160721.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2016
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