To be honest, I think you are making some
huge mistakes here.
Ignoring mechanics of changing your code to work with more than a single row in your database - which is pretty trivial, but will make for some serious sized data transfers and probably be so slow you can't use it - I don't think this is going to work in practice.
The problem is that unless the two images are
identical down to the last tiny detail this will fail. And the only way - the absolutely, positively, definitely, only way - you will get that is if they are the same image. Not two different images of the same finger, but the same images. A tiny, unnoticeable change in position, angle or lighting will make the two images wildly different! So if you want to use this to detect fingerprints, then this is totally the wrong approach, and you really, really, shouldn't waste any more of your time on it.
If you must compare the images to just find the same image, then the first thing to do is not to retrieve any images! Instead, use MD5 or SHA (preferably the later, but it doesn't matter that MD5 is broken for this application) and store that as well as the image data, in a separate column. You then fetch all hash value columns and ids only, and compare that against the hash value you calculate for the image you want to check - only when you find a match do you retrieve the actual image data and compare it directly. This reduces the amount of data you are fetching and comparing to a near-trivial amount and will make your code a lot faster!
using (SqlConnection cn = new SqlConnection(@"Data Source=SAZ-PC\SQLEXPRESS;Initial Catalog=Voted;Integrated Security=True"))
{
using (SqlCommand cmd1 = new SqlCommand("select ID, HashValue from Regdmem ", cn))
{
cn.Open();
using (SqlDataReader reader = cmd1.ExecuteReader())
{
while (reader.Read())
{
int id = (int)reader["ID"];
byte[] hash = (byte[])reader["HashValue"];
}
}
}
}