% 'get info to query sInstruction = Request.QueryString("action") sTitle = Request.QueryString("fTitle") sAuthor = Request.QueryString("fAuthor") sLevelStart = Request.QueryString("fLevelStart") sLevelEnd = Request.QueryString("fLevelEnd") sPoints = Request.QueryString("fPoints") sOrder = Request.QueryString("fOrder") 'strip apostrophes from Title and Author sTitle = Replace(sTitle,"'","",1,-1,1) sAuthor = Replace(sAuthor,"'","",1,-1,1) %>
|
<% 'build query statement xWHERE = " WHERE " If Not (IsNull(sTitle) Or sTitle="") Then xWHERE = xWHERE & " Title LIKE '%" & sTitle & "%'" End If If Not (IsNull(sAuthor) Or sAuthor="") Then If InStr(xWHERE,"Title")<>0 Then xWHERE = xWHERE & " AND Author LIKE '%" & sAuthor & "%'" Else xWHERE = xWHERE & " Author LIKE '%" & sAuthor & "%'" End If End If If Not (IsNull(sLevelStart) Or sLevelStart="") Or Not (IsNull(sLevelEnd) Or sLevelEnd="") Then If IsNull(sLevelStart) Or sLevelStart="" Then sLevelStart=0 End If If IsNull(sLevelEnd) Or sLevelEnd="" Then sLevelEnd=999 End If If InStr(xWHERE,"Title")<>0 Or InStr(xWHERE,"Author")<>0 Then xWHERE = xWHERE & " AND RdLevel Between " & sLevelStart & " AND " & sLevelEnd Else xWHERE = xWHERE & " RdLevel Between " & sLevelStart & " AND " & sLevelEnd End If End If If Not (IsNull(sPoints) Or sPoints="") Then If InStr(xWHERE,"Title")<>0 Or InStr(xWHERE,"Author")<>0 Or InStr(xWHERE,"Level")<>0 Then xWHERE = xWHERE & " AND Points >=" & sPoints Else xWHERE = xWHERE & " Points >=" & sPoints End If End If If xWHERE = " WHERE " Then xWHERE = null End If 'create recordset to open database Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorType = adOpenStatic rs.LockType = adLockOptimistic 'pull records If sInstruction = "querylist" Then 'create headers on table Response.Write "
|
||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|