I'm using digitalpersona u.are.u 4500
fingerprint reader.
This is the codes I used to save fingerprint template to database:
Dim str As New MemoryStream
Enroller.Template.Serialize(str)
Dim serializedTemplate As Byte() = str.ToArray()
Dim bytes() as Byte = serializedTemplate
comm.Parameters.AddWithValue("@Emp_FPrint", bytes)
The problem is when I try to retrieve fingerprint from the database and Deserialize
it , I have this error:
Conversion from type 'Byte()' to type 'Byte' is not valid.
This is the code I used to retrieve and Deserialize
fingerprint:
Sub OnComplete(ByVal Capture As Object, ByVal ReaderSerialNumber As String, ByVal Sample As DPFP.Sample) Implements DPFP.Capture.EventHandler.OnComplete
MakeReport("The fingerprint sample was captured.")
SetPrompt("Scan the same fingerprint again.")
Process(Sample)
CheckTemplate()
If ds1MaxRow > 0 Then
For i = 0 To ds1MaxRow - 1
' byteArray = CType(ds1VerifyFPrintp.Tables("TestImage").Rows(i).Item(1), Byte())
con1 = New SqlConnection
con1.ConnectionString = "Data Source=ERSERVER;Initial Catalog=Timekeeping;User ID=sa;Password=sa"
Dim thequery As String = "Select Emp_FPrint from TestImage "
con1.Open()
Dim cmd As SqlCommand = New SqlCommand(thequery, con1)
Dim rsBioData As SqlDataReader = cmd.ExecuteReader
Dim byteTemplate As Byte
Dim memStreamTemplate As MemoryStream
If rsBioData.HasRows Then
While rsBioData.Read
byteTemplate = rsBioData("Emp_FPrint") ''''''''ERROR HERE : Conversion from type 'Byte()' to type 'Byte' is not valid. '''''''
memStreamTemplate = New MemoryStream(byteTemplate)
Me.Template.DeSerialize(memStreamTemplate)
End While
End If
'''''''STUCK UNTO THIS LINE''''''''''
Dim features As DPFP.FeatureSet = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification)
' 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, Template, result)
' UpdateStatus(result.FARAchieved)
If result.Verified Then
MakeReport("The fingerprint was VERIFIED.")
Else
MakeReport("The fingerprint was NOT VERIFIED.")
End If
End If
Next i
End If
End Sub