Click to See Complete Forum and Search --> : Wildcard searching in CRecordSet


Hussam
April 25th, 1999, 04:05 PM
Hello!

Could anybody answer me why CRecordSet does not fetch any datarecords from a database when the sql includes wild cards.

I just formated a CString with a * as the wild card character. This caused no records to be found. The sql is completely correct and it executes well in access. Shall I maybe use some other methode than *?

Thanks in forward.
Hussam

sean1977
July 24th, 2002, 11:21 AM
What you want to use is %.

example

SELECT * FROM mytable WHERE name LIKE 'T%'

this will return everthing that has a name that starts with T.

If you would like to return every thing that has a T in the name use '%%T%%'.



Seeing what others do not see is called brilliance, knowing what others do not know is called genius.

--Sun Tzu