KarachiCoder
KarachiCoder

Reputation: 87

How to verify DPFP finger print from SQL Server in C#

I have saved the dpfp template in a varbinary(max) column, now I am retrieving it from database, converting to byte[], then deserializing it, and then putting in the verify() method, but an error occurs:

Exception from HRESULT: 0xFFFFFFF8

How I am getting the data is shown here:

SqlConnection cn = new SqlConnection(@"Data Source=Windows\me;Initial Catalog=Enroll;Persist Security Info=True;User ID=sa ;  Password=sa123");

cn.Open();
SqlDataAdapter adp = new SqlDataAdapter("Select varb from employee where employeeid='127'", cn);
DataTable dt = new DataTable();
adp.Fill(dt);
bytes= ConvertDataSetToByteArray(dt);

Template = new DPFP.Template();
Template.DeSerialize(bytes);

<b>Verificator.Verify(features, Template, ref result);</b>
UpdateStatus(result.FARAchieved);

if (result.Verified)
    MakeReport("The fingerprint was VERIFIED.");
else
    MakeReport("The fingerprint was NOT VERIFIED.");

This Verify() is not verifying the data coming from DB.

Where is my mistake? In the conversion? Or in not getting data properly?

Upvotes: 2

Views: 2618

Answers (2)

Allan Menezes
Allan Menezes

Reputation: 1

The problem in my case was storage in the sql server database.

I was using varbinary (MAX) and the fingerprint requires binary (1632). I modified this in the database and it worked.

Upvotes: 0

KarachiCoder
KarachiCoder

Reputation: 87

ConvertDataSetToByteArray() method should be excluded System.Byte in datable will be convert in to byte[] by:

foreach (DataRow row in dt.Rows)
{
    bytes = (byte[])row["varb"];
}

Upvotes: 2

Related Questions