I having problem with my code.
i'm developing a login page with fingerprint scanner. Inserting the template of fingerprint scanner to sql database works fine (nvchar(MAX)),
but when selecting the template from sql im getting error like this:
Unable to cast object of type 'System.String' to type 'System.Byte[]'.
here's my code:
Dim cn As New SqlConnection(ConnectString())
cn.Open()
dim bytes as Byte()
sqlCommand.CommandText = "Select template from usertbl where username='" + registration.txtusername.Text + "'"
sqlCommand.CommandType = CommandType.Text
sqlCommand.Connection = cn
Dim lrd As SqlDataReader = sqlCommand.ExecuteReader()
Dim usr
While lrd.Read()
usr = lrd("template")
End While
bytes = Nothing
bytes = usr
template = New DPFP.Template()
template.DeSerialize(usr)
matcher.Verify(FeatureSet, template, matchResult)
If matchResult.Verified Then
EventHandlerStatus = Gui.EventHandlerStatus.Success
MsgBox("Verified!")
Me.Hide()
registration.Show()
Else
EventHandlerStatus = Gui.EventHandlerStatus.Failure
MsgBox("Please Try Again!")
End If
I'm using DigitalPersona 4500 BTW