Here i am converting image to binary and saving it in sqltable , i got this code from some website but
NOW I DONT KNOW THE WAY TO RETRIEVE THE BINARY DATA
FROM SQL TABLE AND CONVERT IT BACK TO IMAGE FORMAT AND DISPLAY IT IN WEBPAGE

 public byte[] FileToByteArray(string FileName)
        {
             byte[] Buffer = null;
             FileStream FileStream = new FileStream(FileName,FileMode.Open,FileAccess.Read);
             BinaryReader BinaryReader = new BinaryReader(FileStream);

             long TotalBytes = new FileInfo(FileName).Length;

            Buffer = BinaryReader.ReadBytes((Int32)TotalBytes);

            FileStream.Close();
            FileStream.Dispose();
            BinaryReader.Close();   
            return Buffer;
        }

Recommended Answers

All 4 Replies

I have already answered your question.
Please see http://www.daniweb.com/forums/thread209172.html

An "Image" is stored on disk in the native "image format" which is represented with "binary". "Binary" and "Image Format" are the same thing. However a byte[] array and Image are different in managed code.

Go back to the original thread and ask your question and I will elaborate on an answer.

sir i am dumb and i really dont understand that much coding

whatever code i have posted na , in that u make changes and give sir please. I am trying for this from yesterday

Did you not read my post? This thread is probably going to be locked or deleted since you, for the third time, violated the forum rules.

Go back to the original thread and ask your question and I will elaborate on an answer.

sir i am dumb and i really dont understand that much coding

whatever code i have posted na , in that u make changes and give sir please. I am trying for this from yesterday

If you are not interested in reading and trying out already provided suggestion what is then point of this? You just wasting someone time while trying to help you.
And as you already said "sir i am dumb and i really dont understand that much coding" there is no hope to help you if you not willing to cooperate...

PS: Any other forum flooding with same question would be removed and treated as repated rule breaking act

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.