i have a datagrid view. i am using data table to display data
oledbcon.Open()
m_daDataAdapter = New OleDb.OleDbDataAdapter("Select * from Customer", oledbcon)
m_daDataAdapter.Fill(m_dtCustomer)
m_cbCommandBuilder = New OleDb.OleDbCommandBuilder(m_daDataAdapter)
m_rowPosition = m_dtCustomer.Rows.Count
dataGridView1.DataSource = m_dtCustomer
oledbcon.Close()
this works great.
later i want to display only those records tht the user types in the text box. so i use this code
Dim oledbcom As New OleDb.OleDbCommand
oledbcom.CommandText = "Select * from Customer where Company like ?"
oledbcom.Connection = oledbcon
oledbcon.Open()
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
no data is displayed when this code is executed in the text changed event
m using access 2007.