0

我在使用 vb .net 2010 进行指纹验证时遇到问题。 Sql 语句能够检索该值并且能够将字节转换为模板。

错误表示未设置 templa8。

错误开始于 Verificator.Verify(features, templa8, result)

她是错误的,

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)

我的代码如下:

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

请帮忙

4

1 回答 1

0

问题解决了。系统现在工作正常。我刚刚添加了以下代码。

公共事件 OnTemplate(ByVal templa8)

于 2013-09-11T03:20:46.170 回答