If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > How to Search in asp

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-30-04, 08:09
NewfieBullet NewfieBullet is offline
Registered User
 
Join Date: Mar 2004
Posts: 51
Smile How to Search in asp

Hello Thanks for the support

hey

I have page where is want to search my db, this is the statement i have now
SELECT *
FROM ServiceInfo
WHERE (Keywords LIKE '%MMColParam1%' AND ActualLocation LIKE '%MMColParam2%')
ORDER BY Program ASC

MMColParam2 XXXX Request("Search_ActualLocation")
MMColParam1 XXXX Request("Search_Keyword")

I can search the two fields together but i also wanted to search either by keyword or by location. i needs to search by any field or both fields.

Any Sugggestions
Reply With Quote
  #2 (permalink)  
Old 06-30-04, 12:09
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Then keep adding to the WHERE clause...

... WHERE (field1 LIKE value1 AND field1 LIKE value2) OR (field3 LIKE value3 AND field4 LIKE value4)
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #3 (permalink)  
Old 06-30-04, 13:24
NewfieBullet NewfieBullet is offline
Registered User
 
Join Date: Mar 2004
Posts: 51
Smile

Im not really sure what u are saying if i have two box's. One is a txtfield and the other is a list box. I want to be able to search either the txtbox or the list box or both. So i should have 3 where statements following one another and do is use the same variables for the sql string???

Not too good at sql sorry.

Newfiebullet
Reply With Quote
  #4 (permalink)  
Old 06-30-04, 13:31
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
You want to search the text box or list box? Or you want to use the values in the text box and list box to search the database?

If it's the later, you would have two statements in your WHERE clause:

... WHERE field1 = textboxValue OR field1 = listboxValue
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #5 (permalink)  
Old 06-30-04, 15:45
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
Maybe this will give you some ideas:

ASP Design Tips - Search For an Expression on Multiple Fields
http://www.bullschmidt.com/devtip-se...iplefields.asp
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On