How to transfer the source code image into binary

Asked By 0 points N/A Posted on -
qa-featured

I want to know how to transfer the code image into binary for my project. I hope it will immediately solve it because it requires me to pass in my computer subject.

SHARE
Answered By 0 points N/A #162604

How to transfer the source code image into binary

qa-featured
Hi there!
 
Is this for an SQL server? If so, then you have to first set the data type of the field "Image" in which you want your image to be stored. if you want to convert an Image to Binary codes you could try using these codes and put it on the data table.
 
Converting Image to Binary :
 
Public byte [] ObjectToByteArray (Object obj)
        {
            if (obj == null)
                return null;
            BinaryFormatter bf = new BinaryFormatter();
            MemoryStream ms = new MemoryStream();
            bf.Serialize(ms, obj);
            return ms.ToArray();
        }
 
Hope this helps! And hope you pass your exam!

Related Questions