Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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
Edited 18-Feb-13 19:17pm
v2
Comments
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
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 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.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

  Permalink  

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



Advertise | Privacy | Mobile
Web02 | 2.8.140709.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid