My code searches for the same value of the selected item of a listview in the database for example: "01" the code searches for "01" in the database, now 01 in the database is equivalent to a name for example 01 = Name, my problem is; If the code founds 01 i want to get the name instead of the 01.
My Code
Try
Call DatabaseConnection()
MySqlConn.Open()
For Each item As ListViewItem In ListViewAttendance.SelectedItems
Query = "select * from dtr_database.dtr_entries where dtr_entry_number= '" & item.SubItems(0).Text & "'"
Command = New MySqlCommand(Query, MySqlConn)
Reader = Command.ExecuteReader
Dim Count As Integer
Count = 0
While Reader.Read
Count = Count + 1
End While
If Count = 1 Then
'if 01 is found Get Name of 01. How to do this?
MessageBox.Show("Record Found")
ElseIf Count > 1 Then
MessageBox.Show("Multiple Records Found")
Else
MessageBox.Show("Record Found2")
End If
Next
MySqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try