HighDots Forums  

Adv search string

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Adv search string in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Steve
 
Posts: n/a

Default Adv search string - 08-13-2004 , 01:15 AM






I currently have the following code creating a search string and it works
fine until you get to the lower portion if you enter a keyword(search1) it
works fine but if you select a year(years1) it does not return the correct
results and if you dont have a keyword and just want to search by year it
gives me an error because of the AND statement. If anyone can help im kinda
new at this it would be greatly appreciated.


<% Dim SearchString
' Looks for a Category or User
If Request.QueryString("CategoryID") <> "" THEN SearchString = SearchString
& " CategoryID = " & Request.QueryString("CategoryID") END IF
If Request.QueryString("UserID") <> "" THEN SearchString = SearchString & "
UserID = " & Request.QueryString("UserID") END IF
' Search by days
If Request.QueryString("Days") = "3" THEN SearchString = SearchString & "
AdDate >= Date() - 3" END IF
If Request.QueryString("Days") = "7" THEN SearchString = SearchString & "
AdDate >= Date() - 7" END IF
If Request.QueryString("Days") = "14" THEN SearchString = SearchString & "
AdDate >= Date() - 14" END IF
' Looks for search critera from search page
If Request.QueryString("Search1") <> "" THEN SearchString = SearchString & "
Description LIKE '%" & Request.QueryString("Search1") & "%' OR Detailinfo
LIKE '%" & Request.Form("Search1") & "%'" END IF
If Request.QueryString("Years1") <> "0" THEN SearchString = SearchString & "
AND YearID = " & Request.QueryString("Years1") END IF
If Request.QueryString("Brands1") <> "0" THEN SearchString = SearchString &
" AND BrandID = " & Request.QueryString("Brands1") END IF
If Request.QueryString("Scales1") <> "0" THEN SearchString = SearchString &
" AND ScaleID = " & Request.QueryString("Scales1") END IF
SearchString = SearchString
%>
<%
Dim rsResults
Dim rsResults_numRows

Set rsResults = Server.CreateObject("ADODB.Recordset")
rsResults.ActiveConnection = MM_DCT_STRING
rsResults.Source = "SELECT * FROM ResultsQuery WHERE " & SearchString & "
ORDER BY AdDate DESC"
rsResults.CursorType = 0
rsResults.CursorLocation = 2
rsResults.LockType = 1
rsResults.Open()

rsResults_numRows = 0
%>



Steve



Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.