Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
how to retrive image from database and display image in image control.
         i want display image in image control similar to facebook dp.
     
stored image in image datatype
Posted 14-Oct-11 0:21am
Edited 14-Oct-11 0:29am
v2
Comments
hitech_ssc at 14-Oct-11 6:24am
   
what is the datatype of image in database?
M@anish at 19-Feb-13 1:49am
   
i use varchar(500) database for store image path and the image save in images folder
gladiatron at 14-Oct-11 6:32am
   
I would think "Byte"...but storing the string path is easier and suggested..
hitech_ssc at 14-Oct-11 6:40am
   
yes right... 'gladiatron'
bindu kancheti at 27-Aug-12 9:03am
   
how to retrive database to radiobutton list in values?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 
I think storing images in database is not preferable method.
 
so store image in local folders then save imagepath in database table
 
when ever you want that image just place that path in image control
 
  //dt contains retrieved data from database
 image1.ImageUrl=dt.rows[0]["imagepath"].tostring();
 
All the Best
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

well, the one way i use is i store the path of the image in the database and then read that path in my application code and render the image in the image box.
 
System.Drawing.Image and Bitmap classes are your friends to manipulate the image and display it like so:
 
System.Drawing.Image img = (System.Drawing.Image)new Bitmap(filepath);
 
the filepath is the path that you would read from the database.
 
Hope this helps...
Cheers.
  Permalink  
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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 766
1 OriginalGriff 345
2 CPallini 200
3 PIEBALDconsult 150
4 Magic Wonder 131
0 OriginalGriff 5,795
1 Sergey Alexandrovich Kryukov 5,028
2 CPallini 4,700
3 George Jonsson 3,142
4 Gihan Liyanage 2,450


Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 30 Mar 2013
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