Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search and display records. 2

Status
Not open for further replies.

alan28

Technical User
Jul 31, 2002
60
0
0
GB
I want to have a search and display records page on my site. I need to search for names and return their records. Say I search for john smith I want this record to be displayed if someone types "john" or "smith". What is the SQL for that?
 
SELECT * FROM dbo.YourDB WHERE field LIKE '%Parameter%'
 
or

SELECT * FROM tblYourTable WHERE firstName LIKE 'Parameter%' OR lastName LIKE 'parameter2%'

[Peace][Pipe]
The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
Your welcome.

[Peace][Pipe]
The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
I still can not get it to work. This is want I am inputing.

SELECT *
FROM speed
WHERE FNname LIKE %FNname%

FNname % Request.QueryString("FNname")

I am getting a snytax error in query expression '% LIKE %%%'

Where I am going wrong?

 
do a response.write of your sql statement before it executes to see exaclty what is happening, I think you need to put single ' quotes around the variable

Cheech

[Peace][Pipe]
The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top