Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Search feature that matches anywhere in a field


Message #1 by jamesbkim@h... on Tue, 18 Dec 2001 23:16:31
Hello fellows,



I'd like to add a search feature that can filter out records in which

matches anywhere of the field.

For example, if a user input TV, then all the records include 'TV'

anywhere in the subject field come out.

How can I do that?



James
Message #2 by "Owen Mortensen" <ojm@a...> on Tue, 18 Dec 2001 16:14:43 -0700
WHERE subject LIKE '%TV%'



Owen



-----Original Message-----

From: jamesbkim@h... [mailto:jamesbkim@h...]

Sent: Tuesday, December 18, 2001 11:17 PM

To: ASP Databases

Subject: [asp_databases] Search feature that matches anywhere in a field





Hello fellows,



I'd like to add a search feature that can filter out records in which

matches anywhere of the field.

For example, if a user input TV, then all the records include 'TV'

anywhere in the subject field come out.

How can I do that?



James




$subst('Email.Unsub').





Message #3 by jamesbkim@h... on Wed, 19 Dec 2001 00:42:01
Hi Owen,



I used that method but it returned no record matches.

Here is the code that I used.



"where jeprodno.deptno = '" & session("strdeptno") & "' AND '" & session

("product") & "' LIKE '%jeprodno.prodno%' " & _



What's wrong with my coding?



James

Message #4 by "Owen Mortensen" <ojm@a...> on Tue, 18 Dec 2001 17:48:06 -0700
Hmmm.  Is the name of your field really held in the product session

variable?  Are you really looking for a substring match on the exact string

"jeprodno.prodno"?



The AND is going to have precedence over the LIKE (you must match BOTH

conditions).  Why don't you try the query without the AND, just the LIKE and

see if you get anything back.



Another thing to test is to put the SQL call into a variable (strSQL is

common) and then print it out to make sure you're sending to SQL what you

think you are.



Owen



-----Original Message-----

From: jamesbkim@h... [mailto:jamesbkim@h...]

Sent: Wednesday, December 19, 2001 12:42 AM

To: ASP Databases

Subject: [asp_databases] RE: Search feature that matches anywhere in a

field





Hi Owen,



I used that method but it returned no record matches.

Here is the code that I used.



"where jeprodno.deptno = '" & session("strdeptno") & "' AND '" & session

("product") & "' LIKE '%jeprodno.prodno%' " & _



What's wrong with my coding?



James






$subst('Email.Unsub').






  Return to Index