Question on using the LIKE Condition

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, I am currently building a C# application and have a question using a Select statement with the LIKE condition. I have a search window that allows you to type in text to search for on the database. For example see the following: SELECT * FROM Customers Where TechName LIKE 'txtSearchField'. The "txtSearchField" will have the text that the user wants to search for.

I was trying to see if I could use the WildCard Character (*) to search for any text after or before your search. Example: ed* finds anything that begins with ed and has any other characters. This however does not work, I have had to rely on using th percent character (%) to be able to accomplish what I desired. Am I missing something in my command mentioned above, or has this been changed in MS Access 2003? Any help or suggestions will be greatly appreciated!
 
I don't know about C# but accessing data via ADO code uses the wild card "%"
while Access GUI & DAO use "*".

In addition to above, ADO also uses the wild card "_" for single character
while Access GUI & DAO use "?".

--
HTH
Van T. Dinh
MVP (Access)



Ed P. said:
Hello, I am currently building a C# application and have a question using
a Select statement with the LIKE condition. I have a search window that
allows you to type in text to search for on the database. For example see
the following: SELECT * FROM Customers Where TechName LIKE 'txtSearchField'.
The "txtSearchField" will have the text that the user wants to search for.
I was trying to see if I could use the WildCard Character (*) to search
for any text after or before your search. Example: ed* finds anything that
begins with ed and has any other characters. This however does not work, I
have had to rely on using th percent character (%) to be able to accomplish
what I desired. Am I missing something in my command mentioned above, or
has this been changed in MS Access 2003? Any help or suggestions will be
greatly appreciated!
 
Back
Top