Furqan Sehgal
Furqan Sehgal

Reputation: 4997

How to get data using Like Operator

I am trying to get data from my Access database using like operator. For example my ProducID contains NoteBook, Notes etc. Using like operator, I want to get them all shown if user types No etc. Like operator did not give any errors but it only shows record when I put full NoteBook (does not show for Notes offcourse)

Please note I want to use the query in dataset (as shown in the pic)

Please advise how to fix it. Thanksenter image description here

Upvotes: 0

Views: 539

Answers (2)

Fionnuala
Fionnuala

Reputation: 91376

The wildcard is % or *, depending on what you are using to connect, in this case I suggest:

SELECT ... FROM Table WHERE ProductCode LIKE '%'

Regardless of the data type.

Upvotes: 0

Kevin LaBranche
Kevin LaBranche

Reputation: 21098

When you passed in the string "No" did you add the wildcard *No* before and after it to ensure it would return items with no anywhere in the string?

If you only want everything after "No" then you would want "No*".

Upvotes: 1

Related Questions