0

Can someone help me??

How to retrive image from MySQL(not MS_SQL) and show into my <asp:Image> control using c#

Lets said my table on have a field as following:

"SELECT pic FROM image"

Thanks in advance !!

5
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by __avd
0

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

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);
        }
    }

Edited by sourabhtripathi: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.