This is a fingerprint verification application. When verifying,it loops through the table. if the current fingerprint template is the first one on the table row it verifies it correctly. But if the current fingerprint template is located on the 2nd or later rows, it loops through the table and at the first row it rejects the template as not verified, but subsequently after looping through the rows the fingerprint is verified, if indeed it has been stored in the table. My question is how can l loop through all the rows in the table and before l can get the result l desire if verified or not. Below is the code snippet. Please help
Private Sub VerifyBiometric_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
Dim sqlCommand As MySqlCommand = New MySqlCommand()
Dim cn As New MySqlConnection(ConnectString())
cn.Open()
sqlCommand.CommandText = "Select * from ecms.fingerprint"
sqlCommand.CommandType = CommandType.Text
sqlCommand.Connection = cn
Dim sqlCommand As MySqlCommand = New MySqlCommand()
Dim cn As New MySqlConnection(ConnectString())
cn.Open()
sqlCommand.CommandText = "Select * from ecms.fingerprint"
sqlCommand.CommandType = CommandType.Text
sqlCommand.Connection = cn
Dim dataSet As DataSet = New DataSet()
Dim adapter As MySqlDataAdapter = New MySqlDataAdapter(sqlCommand)
Dim dt As New DataTable
Dim dr As DataRow
Try
adapter.Fill(dt)
For Each dr In dt.Rows
Dim bytes As Byte() = Nothing
bytes = dr.Item("FingerP")
Dim template = New DPFP.Template()
template.DeSerialize(bytes)
'Perform match
matcher.Verify(FeatureSet, template, matchResult)
If matchResult.Verified Then
EventHandlerStatus = Gui.EventHandlerStatus.Success
MessageBox.Show("Verified!")
Exit For 'success
End If
If Not matchResult.Verified Then EventHandlerStatus = Gui.EventHandlerStatus.Failure
MessageBox.Show("Verification failed, User does not exist")
'Exit For 'failure
Next
Finally
adapter.Dispose()
cn.Close()
End Try
End Sub