[RESOLVED] Search string syntax
I have a TextBox for the user to input a search string. My button click code returns thr error 'No value given for one or more Parameters. I have tried various ways to write a SELECT string. Help appreciated.
Code:
Private Sub Button36_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button36.Click
'Search
Try
'Clear the Datatable called dt
dt.Clear()
'SELECT conditions
Dim SearchStr As String = "'%" & Me.TextBox18.Text & "%'"
da = New OleDb.OleDbDataAdapter("SELECT * FROM [sheet1$] WHERE Surname LIKE SearchStr AND Member LIKE('%Ply.Member%') ORDER BY Surname", con)
da.Fill(dt)
'Bind the DataGrid to the Table
DataGridView1.DataSource = dt
Catch ex As Exception
MsgBox(ex.Message)
Finally
con.Close()
End Try
End Sub