0

I am having problem in the fingerprint verification using vb .net 2010. Sql statement was able to retrieve the value and was able to convert bytes to template.

error says the templa8 is not set.

error starts at Verificator.Verify(features, templa8, result)

Her is the error,

DPFP.Error.SDKException: Event Handler has generated an Exception ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at LDPS.frmverify.Process(Sample Sample) in D:\My FILES\C# Projects\LDPS\frmverify.vb:line 66
   at LDPS.frmverify.OnComplete(Object Capture, String ReaderSerialNumber, Sample Sample) in D:\My FILES\C# Projects\LDPS\frmverify.vb:line 140
   at DPFP.Capture.Capture.MessageReceived(Message& m)
   --- End of inner exception stack trace ---
   at DPFP.Capture.Capture.MessageReceived(Message& m)
   at DPFP.Capture.Capture.MessageEvents.MessageWindow.WndProc(Message& m)

My code are as follows:

Protected Sub Process(ByVal Sample As DPFP.Sample)
    DrawPicture(ConvertSampleToBitmap(Sample))

    Dim features As DPFP.FeatureSet = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification)

    If TextBox2.Text = String.Empty Then
        MySql = "select customerid,FpTemplate1 from tblFp"
    Else
        MySql = "select a.customerid,b.FpTemplate1 as FpTemplate1,a.customername from tblCustomerDetails a, tblFp b WHERE a.CustomerID = b.CustomerID and CustomerName LIKE '%" & TextBox2.Text & "%'"
    End If

    Conn.Open()

    ' Try

    cmd = New SqlCommand(MySql, Conn)

    Dim reader As SqlDataReader = cmd.ExecuteReader()

    If reader.HasRows Then
        While reader.Read()

            Dim MemStream As IO.MemoryStream
            Dim fpBytes As Byte()

            fpBytes = reader(1)
            MemStream = New IO.MemoryStream(fpBytes)

            Dim templa8 As DPFP.Template = New DPFP.Template()
            templa8.DeSerialize(MemStream)

            Me.Template = templa8

            ' Check quality of the sample and start verification if it's good
            If Not features Is Nothing Then
                ' Compare the feature set with our template
                Dim result As DPFP.Verification.Verification.Result = New DPFP.Verification.Verification.Result()
                Verificator.Verify(features, templa8, result)

                If result.Verified Then

                    Dim comments As String = "This Fingerprint is owned by " & reader(0).ToString

                    MessageBox.Show(comments)
                    Exit Sub
                Else
                    MessageBox.Show("The fingerprint was NOT VERIFIED!")
                End If
            Else
                MessageBox.Show("Fingerprint sample is not established!")
            End If


        End While
    Else
        MessageBox.Show("No record found!")
    End If
    cmd.ExecuteNonQuery()
    '    Catch ex As Exception
    '       MessageBox.Show(ex.Message, "Verification Error")
    '  End Try


    Conn.Close()
End Sub

Please help

rags
  • 2,580
  • 19
  • 37
jetzky
  • 11
  • 1
  • 2
  • 1
    Soooo, whats on line 66? – Dennis Aug 08 '13 at 06:42
  • If you know the exact part of the code where the error is triggered and the exact variable doing it, what is the problem? This error is usually triggered when trying to use a null variable (templa8) where a null variable cannot be used (Verificator.Verify(features, templa8, result)). You are the one populating this variable (templa8.DeSerialize(MemStream)) and thus the one who should determine why it is null (wrong MemStream?). – varocarbas Aug 08 '13 at 08:25

1 Answers1

0

Problem solved. System works fine now. I have just added the following code.

Public Event OnTemplate(ByVal templa8)

jetzky
  • 11
  • 1
  • 2