Query with LIKE

  • Thread starter Thread starter touf
  • Start date Start date
T

touf

Hi,
I've a datagrid having a datatable as datasource. the dataset is filled by
an OleDb DataAdapter (Access 2000), using the folowing query:
Select * from client where address like '*;*; Montreal*'

the problem is that the datagrid is empty, but if I execute this query in
Access directly it gives me some rows.
Note that there is no problem in the dataset or datagrid because whenI
remove the LIKE part (Select * from client ) it gives me a result.


Any help please?
 
The "ambiguator" character is "%" not "*". I suggest:

Select Col, Col2, Col3... from client where address like '% Montreal%'
or
WHERE CharIndex('Montreal', Address) > 0

You might have better performance if you searched by postal code and not by
using a LIKE expression (assuming Postal code has an index).

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top