假设有两列收到日期和项目
如果我搜索有 5 行相同日期的日期
它会出现在文本框中
我请帮忙
*注意,我使用 oledb 作为数据库连接
这是我的搜索代码
Private Sub TxSearch_TextChanged(sender As System.Object, e As System.EventArgs) Handles TxSearch.TextChanged
If Con.State = ConnectionState.Closed Then
Con.Open()
End If
Dad = New OleDb.OleDbDataAdapter("select RecordDate, Item from inv where RecordDate LIKE '%" & TxSearch.Text & "%'", Con)
Dim dt As New DataTable
Dad.Fill(dt)
Me.DataGridView1.DataSource = dt
Con.Close()
DataGridView1.RowsDefaultCellStyle.BackColor = Color.DeepSkyBlue
DataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.White
Con.Close()
SortDatagridviewColumn(0)
End Sub