filter name and username from datagridview using textbox

156 Views Asked by At

i am using combobox for option search name and username and textbox for filter there are error

missing operator

Error Image

        Try
            If Trim(TextBox1.Text) <> "" Then

                dataadapter1 = New OleDbDataAdapter("select * form login where " & ComboBox2.Text & " like '%" & Trim$(TextBox1.Text) & "%'", conn)

                datasetaccounts.Clear()
                dataadapter1.Fill(datasetaccounts, "login")

                DataGridView1.DataSource = datasetaccounts
                DataGridView1.DataMember = "login"
                DataGridView1.Refresh()
            End If
        Catch ex As Exception
            MsgBox("Error !: " + ex.Message)
        End Try
1

There are 1 best solutions below

0
On BEST ANSWER

It should be:

SELECT * FROM ...

rather than:

SELECT * FORM ...

So nothing to do with filtering or ComboBoxes or DataGridViews or any of that. It's exactly what the error message told you: a syntax error in your SQL code.