0
我的代碼在數據庫中搜索與列表視圖的選定項目相同的值,例如:「01」代碼在數據庫中搜索「01」,現在01在數據庫中相當於一個名稱,例如01 = Name,我的問題是; 如果代碼創立01我想要得到的名稱,而不是01如何從mysql數據庫中獲取特定數據vb.net
我的代碼的
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
我從adodb開始,一直到困難的,我必須做更多關於你的建議的研究,所以我可以適應更好,更有效的方式,歡呼! – 2015-02-24 05:26:03