Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Updated 14-Oct-11 0:29am
v2
Comments
hitech_s 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
I.explore.code 14-Oct-11 6:32am    
I would think "Byte"...but storing the string path is easier and suggested..
hitech_s 14-Oct-11 6:40am    
yes right... 'gladiatron'
bindu kancheti 27-Aug-12 9:03am    
how to retrive database to radiobutton list in values?

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

C#
 //dt contains retrieved data from database
image1.ImageUrl=dt.rows[0]["imagepath"].tostring();


All the Best
 
Share this answer
 
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:

C#
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.
 
Share this answer
 
 
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