0

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

Edited by mike_2000_17: Fixed formatting

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

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.

0

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

0

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.

0

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

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.