Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
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 13-Oct-12 4:23am
Comments
Wes Aday at 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 at 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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
 
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();
            }
        }
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Assuming the images should change, you shoudl find this usefull: A generic Image-From-DB class for ASP.NET[^]
  Permalink  

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



Advertise | Privacy | Mobile
Web01 | 2.8.140821.2 | Last Updated 13 Oct 2012
Copyright © CodeProject, 1999-2014
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