<% Dim strSearch, strType, strSearchError, strTypeError, SQLstr, arrEmptyFlag, strProcess 'on Error Resume Next strSearch = Request.Form("searchstr") strType = Request.Form("searchtype") strProcess = Request.Form("process") strSearchError = 0 strTypeError = 0 DateError = 0 if strSearch = "" then strSearchError = 2 end if if strType = "" then strTypeError = 2 end if if strProcess <> 1 then strSearchError = 1 strTypeError = 1 end if if strType = "date" then a = InStr(1,strSearch,"/") b = InStrRev(strSearch,"/") if a = b then DateError = 1 end if end if if strType = "issueno" then if not IsNumeric(strSearch) then strSearchError = 2 end if end if if strTypeError = 0 and strSearchError = 0 and DateError = 0 then %><% if strType = "keyword" then SQLstr = "SELECT VolumeNo,IssueNo FROM Newsletters WHERE Text LIKE '%" & strSearch & "%' ORDER BY IssueNo" elseif strType = "issueno" then SQLstr = "SELECT VolumeNo,IssueNo FROM Archives WHERE IssueNo =" & strSearch & " ORDER BY IssueNo" elseif strType = "date" then SQLstr = "SELECT VolumeNo,IssueNo FROM Archives WHERE Date = #" & strSearch & "# ORDER BY IssueNo" end if 'Response.Write SQLstr objRS.Open SQLstr,objConn,1 if not objRS.EOF then arrSearchResults = objRS.GetRows() else arrEmptyFlag = 1 end if objRS.Close if arrEmptyFlag <> 1 then Response.Write "Search returned " & (ubound(arrSearchResults,2) + 1) & " result(s)." for i = 0 to ubound(arrSearchResults,2) %>
  • Volume <%=arrSearchResults(0,i)%>: Issue <%=arrSearchResults(1,i)%>
  • <% next else Response.Write "Search returned 0 results." end if else if DateError = 1 then strSearchError = 3 Response.Write "Date entered is not valid. Date format is MM/DD/YY.
    " end if if strSearchError = 2 then Response.Write "Text entered is not valid for this type of search.
    " end if if strTypeError = 2 then Response.Write "You should select a valid type of search.
    " end if %>
    <%if strSearchError = 2 then%><%end if%>Search for:
    <%if strTypeError = 2 then%><%end if%>Type of search: Keyword
    Issue #
    Date
    <% end if set objConn = nothing set objRS = nothing %>