954,577 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to retrieve image from MySQL(not MS SQL) and show in the <asp:image> control, c#

Can someone help me??

How to retrive image from MySQL(not MS_SQL) and show into my control using c#

Lets said my table on have a field as following:

"SELECT pic FROM image"

Thanks in advance !!

hwa
Newbie Poster
17 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

I have the problem too. I searched but not found any solution. plz guid me
(^_^)

shasani
Newbie Poster
1 post since May 2010
Reputation Points: 10
Solved Threads: 0
 

You should save the image path in the table. Then retrieve from it.

Michaeel
Newbie Poster
4 posts since May 2010
Reputation Points: 7
Solved Threads: 0
 

get Byte Array from DB then convert it into image and save it into some folder on serverside then use the URL of that image to represent it
eg:-
imageSample.imageURL=~URLofYourImage;
CODE:-

public  void byteArrayToImage(byte[] byteArrayIn)
    {
        try
        {
            MemoryStream ms = new MemoryStream(byteArrayIn);
            System.Drawing.Image imgPhoto =  System.Drawing.Image.FromStream(ms);
            imgPhoto.Save(Server.MapPath("temp.jpg"));
            imgEmployee.ImageUrl = "~/Employee/temp.jpg";
        }
        catch (Exception ex)
        {
            imgEmployee.ImageUrl = "~/Admin/emp1.jpg";
            ExceptionLogger.PublishError(ex);
        }
    }
sourabhtripathi
Newbie Poster
22 posts since May 2010
Reputation Points: 0
Solved Threads: 2
 

Please do not resurrect old threads. If you have any questions please ask. .... You are welcome to start your own threads.

Please read the rules before posting again - http://www.daniweb.com/forums/thread78223.html and rules .

Thread Closed.

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You