当然,我确信这很容易,但我因某些原因而陷入困境。 我有以下内容,如果它们以变量s开头,则从数据库中选择名称。 但我没有得到结果。
Public Sub load_oraria_EPAFES_FORM2(ByVal DATAGRID As DataGridView, ByVal LETTER As Button)
Dim sda As New MySqlDataAdapter
Dim dbdataset As New DataTable
Dim bsource As New BindingSource
conn()
Try
MessageBox.Show(LETTER.Text)
mysqlconn.Open()
dbdataset.Clear()
Dim query As String
query = "select * from db.epafes WHERE (SURNAME LIKE '%" & LETTER.Text & "% ') "
command = New MySqlCommand(query, mysqlconn)
sda.SelectCommand = command
sda.Fill(dbdataset)
bsource.DataSource = dbdataset
DATAGRID.DataSource = bsource
sda.Update(dbdataset)
mysqlconn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
mysqlconn.Dispose()
End Try
End Sub
答案 0 :(得分:0)
就像想象的那样......时间停止,我可能已经累了...... 解决方案:query =“select * from db.epafes WHERE SURNAME like'%”& LETTER.Text& “%'”
我错过了一些“!