Skip to content

I want to check the images is present or not in msaccess

Er Jasvinder Nehal

Er Jasvinder Nehal

Asked May 13, 2015, 8:42 AM EDT1 answer
Share
LinkedInX
hi all
i am implement a application first i stored the images in binary form in ms access database using C#.
now i want to check new uploaded images is present or not in database .means comparing between two  binary images 
 
Please anyone help me
thanks in advance 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Manoj Bhoir
    0
    Hi,

    You can compare two binary image data in C#.

    Please see this code sample :

    static bool StreamEquals(Stream stream1, Stream stream2)
    {
        const int bufferSize = 2048;
        byte[] buffer1 = new byte[bufferSize]; //buffer size
        byte[] buffer2 = new byte[bufferSize];
        while (true) {
            int count1 = stream1.Read(buffer1, 0, bufferSize);
            int count2 = stream2.Read(buffer2, 0, bufferSize);

            if (count1 != count2)
                return false;

            if (count1 == 0)
                return true;

            // You might replace the following with an efficient "memcmp"
            if (!buffer1.Take(count1).SequenceEqual(buffer2.Take(count2)))
                return false;
        }
    }
    0