Как войти в систему с изображением в качестве пароля
Hi, I'm trying to setup a Login with fingerPrints. The idea is to select username from a combobox and provide fingerprint. The pair is then compared against database stored values and if a match is hit Access is granted. The datatype of the print is 'image' in the database however to store it i have to convert it to an array of type byte. ComboBox1 DropDownStyle is DropDownList My idea is to convert whatever is in the picture box to the same datatype and then compare. I have not been successful. I keep receiving the message ; {"The data types image and varbinary(max) are incompatible in the equal to operator."} raised at >> dr = clgq.ExecuteReader(); << what do i need to to get this right. I already included the System.Drawing.Imaging, System.IO, Libraries.Help Please
Что я уже пробовал:
private void button2_Click(object sender, EventArgs e) { string lgq = "select name, picture from photo where name= '" + comboBox1.Text + "' and picture= @pc"; MemoryStream ms = new MemoryStream();//Declare a memory stream pictureBox1.Image.Save(ms, ImageFormat.Jpeg);//Create a value of PictureBox1 as a memory stream with jpg encoding byte[] pic = ms.ToArray(); //convert this memory stream to an array of bytes SqlCommand clgq = new SqlCommand(lgq, con); clgq.Parameters.AddWithValue("@pc", pic); SqlDataReader dr; dr = clgq.ExecuteReader(); int T = 0; while(dr.Read()) { T++; } if (T == 1) MessageBox.Show("Login Successful", " ", MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show("Login Not Successful", " ", MessageBoxButtons.OK, MessageBoxIcon.Stop); }