<%@language=vbscript codepage=936 %> 
<!--#include file="../Connections/connSearch.asp" --> 
<% 
BookName = Trim(Request.Form("BookName")) 
BookType = Trim(Request.Form("BookType")) 
Author = Trim(Request.Form("Author")) 
BookPub = Trim(Request.Form("BookPub")) 
PubYear = Trim(Request.Form("Year")) 
PubMonth = Trim(Request.Form("Month")) 
PageCompare = Trim(Request.Form("PageCompare")) 
Pages = Trim(Request.Form("Pages")) 
PriceCompare = Trim(Request.Form("PriceCompare")) 
Price = Trim(Request.Form("Price")) 
if (BookType = "")then 
Flag = True 
Else 
Flag = False 
end if 
StrSql = "" 
If BookName <> "" then 
StrSql = "bookName like '%" &BookName&"%'" 
end if If BookType <> "全部" Then 
If Trim(StrSql & " ") = "" Then 
            StrSql = " className ='" & BookType& "'" 
  Else 
            StrSql = StrSql & " and className ='" & BookType& "'" 
  End If 
End If 
    
If Author <> "" Then 
  If Trim(StrSql & " ") = "" Then 
    StrSql = " bookAuthor like '%" &Author& "%'" 
  Else 
    StrSql = StrSql & " and bookAuthor like '%" &Author& "%'" 
  End If 
End If 
    
If bookPub <> "" Then 
  If Trim(StrSql & " ") = "" Then 
    StrSql = " bookPub like '%" &BookPub& "%'" 
  Else 
    StrSql = StrSql & " and bookPub like '%" &BookPub& "%'" 
  End If 
End If 
    
If PubYear <> "" Then 
  PubDate = CDate(PubYear & "-" & PubMonth & "-01") 
  If Trim(StrSql & " ") = "" Then 
      StrSql = " bookPubDate = #" & PubDate & "#" 
  Else 
      StrSql = StrSql & " and bookPubDate = #" & PubDate & "#" 
  End If 
End If 
    
If Pages <> "" Then 
If Trim(StrSql & "") = "" Then 
  StrSql = "bookPages "& PageCompare &" "&CInt(Pages)&"" 
Else 
    StrSql = StrSql & " and bookPages "& PageCompare &" "&CInt(Pages)&"" 
End If 
End If If Price <> "" Then 
If Trim(StrSql & "") = "" Then 
  StrSql = "Price "& PriceCompare &" "&CCur(Price)&"" 
Else 
    StrSql = StrSql & " and Price "& PriceCompare &" "&CCur(Price)&"" 
End If 
End If %> 
<% 
Dim Rs1 
Dim Rs1_numRows Set Rs1 = Server.CreateObject("ADODB.Recordset") 
Rs1.ActiveConnection = MM_connSearch_STRING 
Rs1.Source = "SELECT Distinct ClassName  FROM Books" 
Rs1.CursorType = 0 
Rs1.CursorLocation = 2 
Rs1.LockType = 1 
Rs1.Open() Rs1_numRows = 0 
%> 
<% 
if Flag=False then 
Dim Rs2 
Dim Rs2_numRows Set Rs2 = Server.CreateObject("ADODB.Recordset") 
Rs2.ActiveConnection = MM_connSearch_STRING 
if Trim(StrSql) <>"" then 
Rs2.Source = "SELECT *Search.a FROM Books where " &StrSql union all "SELECT * FROM a where "&StrSql 
else 
Rs2.Source = "SELECT * FROM Books union all SELECT * FROM a" 
end if Rs2.CursorType = 0 
Rs2.CursorLocation = 2 
Rs2.LockType = 1 
Rs2.Open() Rs2_numRows = 0 
end if 
%>