第一次要求不那么好的程序员需要有关搜索查询的帮助,可以搜索数据库中的多个数据名称
Private Sub Search()
Dim MySQLConnection As New MySqlConnection("host=127.0.0.1; user=root; database=sample")
Dim READER As MySqlDataReader
Try
MySQLConnection.Open()
Dim Query As String
Query = "select * from instructor where (IID LIKE '%" & SearchBox.Text & "%')"
Cmd = New MySqlCommand(Query, MySQLConnection)
READER = Cmd.ExecuteReader
If READER.Read() Then
lbl_ID.Text = READER("IID").ToString
lbl_College.Text = READER("College").ToString
lbl_Dept.Text = READER("Department").ToString
lbl_Last.Text = READER("Lastname").ToString
lbl_Middle.Text = READER("Middlename").ToString
lbl_Name.Text = READER("Firstname").ToString
lbl_EMPstatus.Text = READER("EmploymentStatus").ToString
lbl_EMPtype.Text = READER("EmploymentType").ToString
End If
MySQLConnection.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MySQLConnection.Dispose()
End Try