I load the data from a database into a BindingSource and use it to do searches.
The same is tied with a datagridview
, which returns me the requested data, at the moment I am using LIKE to do these searches, however it is not pleasing to me see the example below:
ValorProcurado = Par*3/4*3 >>>>> aqui estou tentando procurar um parafuso 3/4x3 na minha tabela
Dim Tabela As New BindingSource
Dim Valores() As String = Split(ValorProcurado, "*")
Dim Valor As String = ""
Dim ValorFiltro As String = ""
For Each Valor In Valores
If ValorFiltro = "" Then
ValorFiltro = "'%" & Valor & "%'"
Else
ValorFiltro = ValorFiltro & " AND " & ColunaFiltro & " LIKE '%" & Valor & "%'"
End If
Next
Tabela.Filter = "Descricao LIKE " & ValorFiltro
The way I'm doing I can look up the values, but it's not searched in the sequence I put it, I wanted in this example above that the datagridview returns me items that start with "par" and then following the sequence "3/4" and then had "3".