Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends ,

I am having a default.aspx page in which at top left corner , top middle , and top right , bottom left side and bottom right side , i should upload or fetch image from database , so kindly explain me how to insert , update , image into database

and i should also fetch the image from database in pageload events at top left side , top middle , top right , bottom left and bottom right of the page
Posted
Comments
[no name] 13-Oct-12 10:25am    
Okay so do a google search for how to save and retrieve images for whatever database you are using
psychic6000 13-Oct-12 11:29am    
your question doesnt give much information, first of all what kind of database you are connecting to? Oracle or SQL etc secondly you are connected to your database using LINQ datasource (or sql client connection).
anyway, you need a stream reader and byte array to convert/de-convert your image to bytes, than save/load it into/out of database

Assuming the images should change, you shoudl find this usefull: A generic Image-From-DB class for ASP.NET[^]
 
Share this answer
 
Check this link
http://csharpdotnetfreak.blogspot.com/2009/07/fileupload-control-save-images-database.html[^]

and to show on page_load
drag image control and
fetch saved image url from database like

C#
SqlConnection sqlconn = new SqlConnection("server=.\\sqlexpress;database=db;integrated security=true;");
            SqlCommand sqlcomm = new SqlCommand("select image_url from reg1", sqlconn);
            sqlconn.Open();
            SqlDataReader dr = sqlcomm.ExecuteReader();
            if (dr.Read())
            {
                
                string loc = dr["profile_dploc"].ToString();
                Image1.ImageUrl = "profilepicture/" + loc;
                Session["dp"] = loc;
                sqlconn.Close();
                dr.Close();
            }
        }
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900