如何匹配mysql数据库中的指纹fmd [英] How can I match a fingerprint fmd from mysql database

查看:206
本文介绍了如何匹配mysql数据库中的指纹fmd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,抱歉我的英语不好。我是印度尼西亚SMK的学生,我想为我的学校制作管理系统,我使用U Are U From Digital Persona作为学生考勤系统,我初学VB.Net与Digital Persona U接口是U 4500问题是,我不知道错误是什么,我不知道如何反序列化和序列化FMD到MySQL数据库。我的数据库数据类型是LONGBLOB。我使用此代码进行序列化



 cmd =  MySqlCommand(< span class =code-string> 插入finger_data(finger)值(@jari),conn)
使用 cmd
.Parameters.AddWithValue( @ jari ,Fmd.SerializeXml(resultConversion.Data))
.ExecuteNonQuery()
结束 使用





当我将序列化fmd存储到数据库工作时。我不知道如何反序列化。



我尝试过:



我试过这个代码从数据库反序列化fmd。我收到此错误消息System.Data.dll中发生类型'System.IndexOutOfRangeException'的未处理异常



附加信息:位置1没有行。



这是我的反序列化代码。我已经试了很长时间了...所以任何人都可以帮助我...谢谢之前... < br $> b $ b

 公共  Sub  OnCaptured( ByVal  captureResult  As  CaptureResult)

如果 _sender.CheckCaptureResult(captureResult)那么
返回
结束 如果

SendMessage(Action.SendMessage, 指纹已被捕获

Dim resultConversion 正如 DataResult( Of Fmd)= FeatureExtraction.CreateFmdFromFid(captureResult.Data,Constants.Formats.Fmd.ANSI)
如果 captureResult.ResultCode<> Constants.ResultCode.DP_SUCCESS 然后
_sender.Reset = True
抛出 异常(captureResult.ResultCode.ToString())
结束 如果

如果 count = 0 然后

firstFinger = resultConversion.Data
count + = 1
SendMessage(Action.SendMessage, 现在放置相同的或读取器上的其他手指。

ElseIf count = 1 然后

secondFinger = resultConversion.D ata
count + = 1
SendMessage(Action.SendMessage, 现在将相同或不同的手指放在阅读器上。

ElseIf count = 2 然后

AnyFinger = resultConversion.Data
Dim fmds As Fmd()= Fmd( 1 ){}
fmds( 0 )= firstFinger
fmds( 1 )= secondFinger

Dim thresholdScore 正如 整数 = PROBABILITY_ONE * 1 / 10000

Dim ds As DataSet
adt = MySqlDataAdapter( select * from finger_data where finger,conn)
adt.Fill(ds, finger_data

Dim A As 整数 = ds.Tables( finger_data )。行( 1 )。项目( 0 )//我有错误 此行
Dim Y < span class =code-keyword>作为 字节()= DirectCast (ds.Tables( finger_data)。行( 0 )。项目( 2 ),字节())
Dim As < span class =code-keyword> String = System.Text.Encoding.Unicode.GetString(Y)
Dim X = Fmd。 DeserializeXml(value)

Dim identifyResult As IdentifyResult = Comparison.Identify(X , 0 ,fmds,thresholdScore, 2
如果 identifyResult.ResultCode<> Constants.ResultCode.DP_SUCCESS 然后
_sender.Reset = True
抛出 异常(identifyResult.ResultCode.ToString())
结束 如果

SendMessage(Action.SendMessage, 标识结果 + identifyResult.Indexes.Length.ToString())
SendMessage(Action.SendMessage, 放置索引
count = 0
结束 如果
结束 Sub

解决方案

错误消息非常清楚 - 您正在尝试访问表的第二行,但该表没有两行。 (请记住,集合是从零开始的,所以第一行是索引 0 。)



根据后续行,您希望从表中访问第一个行,因此您需要将行索引更改为 0



但是,在尝试访问之前,还应检查查询是否返回了一行。

 adt.Fill(ds,  finger_data

如果 ds.Tables( finger_data).Rows.Count = 0 然后
' 没有返回任何行。在此处向用户显示错误消息。
否则
Dim 作为 整数 = ds.Tables( finger_data)。行( 0 )。项目( 0
...
结束 如果


Hello, Sorry for my Bad English. Im a student in indonesian SMK which i want to make management system for my school, I used U Are U From Digital Persona for Student Attendance System and i beginner on VB.Net interfacing with Digital Persona U Are U 4500 The problem is, i dont know what the error and i dont know how to Deserialize and Serialize An FMD to MySQL Database. My database datatype is LONGBLOB. I Used this code for serialize

cmd = New MySqlCommand("insert into finger_data(finger) values(@jari)", conn)
With cmd
   .Parameters.AddWithValue("@jari", Fmd.SerializeXml(resultConversion.Data))
   .ExecuteNonQuery()
End With



When i stored the serialize fmd to database is work. And i dont know how to Deserialize.

What I have tried:

I Tried this code for Deserialize fmd from database. And i get this error message "An unhandled exception of type 'System.IndexOutOfRangeException' occurred in System.Data.dll

Additional information: There is no row at position 1.

This My Code For Deserialize. I have tried for a long days for this... So Anyone can help me please... Thanks before...

Public Sub OnCaptured(ByVal captureResult As CaptureResult)

        If Not _sender.CheckCaptureResult(captureResult) Then
            Return
        End If

        SendMessage(Action.SendMessage, "The Fingerprint Was Captured")

        Dim resultConversion As DataResult(Of Fmd) = FeatureExtraction.CreateFmdFromFid(captureResult.Data, Constants.Formats.Fmd.ANSI)
        If captureResult.ResultCode <> Constants.ResultCode.DP_SUCCESS Then
            _sender.Reset = True
            Throw New Exception(captureResult.ResultCode.ToString())
        End If

        If count = 0 Then

            firstFinger = resultConversion.Data
            count += 1
            SendMessage(Action.SendMessage, "Now place the same or a different finger on the reader.")

        ElseIf count = 1 Then

            secondFinger = resultConversion.Data
            count += 1
            SendMessage(Action.SendMessage, "Now place the same or a different finger on the reader.")

        ElseIf count = 2 Then

            AnyFinger = resultConversion.Data
            Dim fmds As Fmd() = New Fmd(1) {}
            fmds(0) = firstFinger
            fmds(1) = secondFinger

            Dim thresholdScore As Integer = PROBABILITY_ONE * 1 / 10000

            Dim ds As New DataSet
            adt = New MySqlDataAdapter("select * from finger_data where finger", conn)
            adt.Fill(ds, "finger_data")

            Dim A As Integer = ds.Tables("finger_data").Rows(1).Item(0) //I got Error on this Line
            Dim Y As Byte() = DirectCast(ds.Tables("finger_data").Rows(0).Item(2), Byte())
            Dim value As String = System.Text.Encoding.Unicode.GetString(Y)
            Dim X = Fmd.DeserializeXml(value)

            Dim identifyResult As IdentifyResult = Comparison.Identify(X, 0, fmds, thresholdScore, 2)
            If identifyResult.ResultCode <> Constants.ResultCode.DP_SUCCESS Then
                _sender.Reset = True
                Throw New Exception(identifyResult.ResultCode.ToString())
            End If

            SendMessage(Action.SendMessage, "Result Of The Identification " + identifyResult.Indexes.Length.ToString())
            SendMessage(Action.SendMessage, "Place Index")
            count = 0
        End If
    End Sub

解决方案

The error message is quite clear - you're trying to access the second row of the table, but the table doesn't have two rows. (Remember, the collections are zero-based, so the first row is at index 0.)

Based on the subsequent line, you want to access the first row from the table, so you need to change the row index to 0.

However, you should also check that the query returned a row before you try to access it.

adt.Fill(ds, "finger_data")

If ds.Tables("finger_data").Rows.Count = 0 Then
    ' No rows returned. Show an error message to the user here.
Else
    Dim A As Integer = ds.Tables("finger_data").Rows(0).Item(0)
    ...
End If


这篇关于如何匹配mysql数据库中的指纹fmd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆