Search code examples
c#sqlbiometricsdigital-persona-sdk

Digital Persona Finger Print Verification from DataBase not working


   Device  :  Digital Persona u.are.u 4500 

While enrollment i am saving the data in sql database in image format(sql data type is image) It works properly my data is properly saved in database,,but now when i am verifying the data during my verification its giving exception

hresult : 0xffff.

Here is my C# code for verification

SqlConnection conn = new SqlConnection(connetionstring);
conn.Open();
SqlCommand cmd = new SqlCommand("SELECT * FROM mySavedDataTable", conn);
MemoryStream ms;
byte[] fpBytes;
SqlDataAdapter sd = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sd.Fill(dt);

foreach (DataRow dr in dt.Rows)
{
    fpBytes = Encoding.UTF8.GetBytes(dr["Template"].ToString());
    ms = new System.IO.MemoryStream(fpBytes);
    DPFP.Template template = new DPFP.Template();
    template.Serialize(ms);
    Verificator.Verify(features, template, ref result);
    if (result.Verified)
    {
        ver = true;
        break;
    }
}
conn.Close();

Solution

  • I have done like this and it works like charm!

    DataResult<Fmd> resultConversion = null;
    IdentifyResult identifyResult = null;
    string MobileNumber = "";
    string Cnic = "";
    
    // Check capture quality and throw an error if bad.
    if (!this.CheckCaptureResult(captureResult)) return;
    // See the SDK documentation for an explanation on threshold scores.
    int thresholdScore = DPFJ_PROBABILITY_ONE * 1 / 100000;
    DataSet dataSetBiometric = DatabaseHandler.getData("select CNIC, MOBILE_NUMBER, BIOMETRIC from ACCOUNT_OPENING");
    //select CNIC, MOBILE_NUMBER, BIOMETRIC from ACCOUNT_OPENING
    Fmd[] fmds = new Fmd[dataSetBiometric.Tables[0].Rows.Count];
    for (int i = 0; i < dataSetBiometric.Tables[0].Rows.Count; i++)
    {
        fmds[0] = Fmd.DeserializeXml(dataSetBiometric.Tables[0].Rows[i]["BIOMETRIC"].ToString());//BIOMETRIC
        resultConversion = FeatureExtraction.CreateFmdFromFid(captureResult.Data, Constants.Formats.Fmd.ANSI);
        identifyResult = Comparison.Identify(resultConversion.Data, 0, fmds, thresholdScore, dataSetBiometric.Tables[0].Rows.Count);
        if (identifyResult.ResultCode == Constants.ResultCode.DP_SUCCESS)
        {
            MobileNumber = dataSetBiometric.Tables[0].Rows[i]["MOBILE_NUMBER"].ToString();
            Cnic = dataSetBiometric.Tables[0].Rows[i]["CNIC"].ToString();
            break;
        }
    }