the code doesnt retrieve any data from the database
datagridview1 always remains blank

Dim oledbcom As New OleDb.OleDbCommand
        oledbcom.CommandText = "Select * from customer where company like '*?*'"
        oledbcom.Connection = oledbcon

        oledbcom.Parameters.Add("?", OleDb.OleDbType.VarChar)
        Dim company As String = txtSearch.Text.Trim
        oledbcom.Parameters(0).Value = company.ToString

        Dim da As New OleDb.OleDbDataAdapter(oledbcom)
        Dim dt As New DataTable
        da.Fill(dt)
        dataGridView1.DataSource = dt

Use

oledbcom.CommandText = "Select * from .... like *?*"

if i remove the single inverted commas this is the error that i get

Syntax error (missing operator) in query expression 'company like *?*'
..
oledbcom.CommandText = "Select * from customer where company like ?"
..
oledbcom.Parameters.Add("?", OleDb.OleDbType.VarChar)
Dim company As String = txtSearch.Text.Trim
oledbcom.Parameters(0).Value = "*" & company.ToString & "*"
...

still not fetching any data

Which database product are you using?

m using access

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.