Click here to Skip to main content
12,396,047 members (64,098 online)
Rate this:
 
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
Updated 14-Oct-11 0:29am
v2
Comments
hitech_ssc 14-Oct-11 6:24am
   
what is the datatype of image in database?
M@anish 19-Feb-13 1:49am
   
i use varchar(500) database for store image path and the image save in images folder
gladiatron 14-Oct-11 6:32am
   
I would think "Byte"...but storing the string path is easier and suggested..
hitech_ssc 14-Oct-11 6:40am
   
yes right... 'gladiatron'
bindu kancheti 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  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

  Permalink  

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
Web02 | 2.8.160721.1 | Last Updated 30 Mar 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