Tiny SQL Question

Joined
Aug 3, 2002
Messages
19
Hi All,

This is a short SQL Question... how do i retrieve all the records of the people with the same name...

Example: in a textbox i type in Adam and i click search... now this is supposed to check the database and list out all the Adams in the database...

i just need the SQL syntax for this...

Comm.CommandText = "Select * From Customers WHERE " _
& "ClientID LIKE " & ClientIDTxt.Text & ""

what is it that i add to this syntax?

Thanks heaps

~John~
 
Are we to assume ClientIDTxt.Text contains Adam, and the ClientID column in Customers has various names?

SELECT * FROM Customers WHERE ClientID LIKE Adam%

Will find names that begin with Adam, ie; Adamness. It will not find names like Ladam.

SELECT * FROM Customers WHERE ClientID LIKE %Adam

Will find names that end with Adam, ie; Ladam. It will not find names like Adamness (because of the ness at the end).

SELECT * FROM Customers WHERE ClientID LIKE %Adam%

Will find names that containt Adam anywhere within it, ie; Adamness and Ladam.
 
Back
Top