home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / is20.cab / AdvSQLQ.asp < prev    next >
Text File  |  1997-10-14  |  18KB  |  518 lines

  1. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
  2. <HTML>
  3. <HEAD>
  4. <SCRIPT LANGUAGE="VBScript" RUNAT="Server">
  5. <!--#INCLUDE FILE="adovbs.inc"-->
  6.  
  7. </SCRIPT>
  8. <BODY background="is2bkgnd.gif" OnLoad="SetAll()" LANGUAGE=JavaScript>
  9. <TITLE>Advanced Index Server Search Form</TITLE>
  10. <LINK REL=STYLESHEET HREF="is2style.css" TYPE="text/css">
  11. <META NAME="DESCRIPTION" CONTENT="Sample SQL query form for Microsoft Index Server">
  12. <META NAME="AUTHOR"      CONTENT="OLE DB Provider for Index Server Team">
  13. <META NAME="KEYWORDS"    CONTENT="sql, query, content, hit">
  14. <META NAME="SUBJECT"     CONTENT="sample form">
  15. <META NAME="MS.CATEGORY" CONTENT="Internet">
  16. <META NAME="MS.LOCALE"   CONTENT="EN-US">
  17. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Windows-1252">
  18. <%
  19. Const STAT_BUSY    = 0  
  20. Const STAT_ERROR = &H1 
  21. Const STAT_DONE    = &H2  
  22. Const STAT_REFRESH    = &H3  
  23. Const STAT_PARTIAL_SCOPE    = &H8  
  24. Const STAT_NOISE_WORDS    = &H10  
  25. Const STAT_CONTENT_OUT_OF_DATE    = &H20  
  26. Const STAT_REFRESH_INCOMPLETE    = &H40  
  27. Const STAT_CONTENT_QUERY_INCOMPLETE    = &H80  
  28. Const STAT_TIME_LIMIT_EXCEEDED    = &H100  
  29.  
  30. Function GetCiOutOfDate(value)
  31.     GetCiOutOfDate = value And STAT_CONTENT_OUT_OF_DATE
  32. end Function
  33.  
  34. Function GetCiQueryIncomplete(value)
  35.     GetCiQueryIncomplete = value And STAT_CONTENT_QUERY_INCOMPLETE
  36. end Function
  37.  
  38. Function GetCiQueryTimedOut(value)
  39.     GetCiQueryTimedOut = value And STAT_TIME_LIMIT_EXCEEDED
  40. end Function
  41.  
  42. DebugFlag = FALSE
  43. NewQuery = FALSE
  44. UseSavedQuery = FALSE
  45. SearchString = ""
  46. QueryForm = Request.ServerVariables("PATH_INFO")
  47. if Request.ServerVariables("REQUEST_METHOD") = "POST" then
  48.     SearchString = Request.Form("SearchString")
  49.     DocAuthorRestriction = Request.Form("DocAuthorRestriction")
  50.     FSRest = Request.Form("FSRest")
  51.     FSRestVal = Request.Form("FSRestVal")
  52.     FSRestOther = Request.Form("FSRestOther")
  53.     FMMod = Request.Form("FMMod")
  54.     FMModDate = Request.Form("FMModDate")
  55.     SortBy = Request.Form("SortBy")
  56.     Colset = Request.Form("ColChoice")
  57.     ' NOTE: this will be true only if the button is actually pushed.
  58.     if Request.Form("Action") = "Execute" then
  59.         NewQuery = TRUE
  60.     elseif Request.Form("pg") <> "" then
  61.         UseSavedQuery=TRUE
  62.         NextPageNumber = Request.Form("pg")
  63.     end if
  64. End if
  65. %>
  66. </HEAD>
  67.  
  68. <TABLE>
  69.     <TR><TD><A HREF="http://www.microsoft.com/ntserver/search" target="_top"><IMG SRC ="is2logo.gif" border=0 VALIGN=MIDDLE ALIGN=LEFT></a></TD></TR>
  70.     <TR><TD ALIGN="RIGHT"><H3>Advanced SQL Sample</H3></TD></TR>
  71. </TABLE>
  72.  
  73.  
  74. <SCRIPT LANGUAGE=JavaScript>
  75. <!--
  76. function SetAll()
  77. {
  78.     document.QForm.SearchString.value = "<%=SearchString%>";
  79.     
  80.     <%select case FSRest%>
  81.     <%case " > "%>
  82.         document.QForm.FSRest.selectedIndex = 1;
  83.     <%case else%>
  84.         document.QForm.FSRest.selectedIndex = 0;
  85.     <%end select%>
  86.  
  87.     <%select case FSRestVal%>
  88.     <%case "any"%>
  89.         document.QForm.FSRestVal.selectedIndex = 0;
  90.     <%case "100"%>
  91.         document.QForm.FSRestVal.selectedIndex = 1;
  92.     <%case "1024"%>
  93.         document.QForm.FSRestVal.selectedIndex = 2;
  94.     <%case "10240"%>
  95.         document.QForm.FSRestVal.selectedIndex = 3;
  96.     <%case "102400"%>
  97.         document.QForm.FSRestVal.selectedIndex = 4;
  98.     <%case "1048576"%>
  99.         document.QForm.FSRestVal.selectedIndex = 5;
  100.     <%case "10485760"%>
  101.         document.QForm.FSRestVal.selectedIndex = 6;
  102.     <%case "104857600"%>
  103.         document.QForm.FSRestVal.selectedIndex = 7;
  104.     <%case "other"%>
  105.         document.QForm.FSRestVal.selectedIndex = 8;
  106.     <%case else%>
  107.         document.QForm.FSRestVal.selectedIndex = 0;
  108.     <%end select%>
  109.  
  110.     document.QForm.FSRestOther.value = "<%=FSRestOther%>";
  111.  
  112.     <%select case FMMod%>
  113.     <%case "any"%>
  114.         document.QForm.FMMod.selectedIndex = 0;
  115.     <%case "DATEADD(minute, -10, GETGMTDATE())"%>
  116.         document.QForm.FMMod.selectedIndex = 1;
  117.     <%case "DATEADD(hour, -1, GETGMTDATE())"%>
  118.         document.QForm.FMMod.selectedIndex = 2;
  119.     <%case "DATEADD(day, -1, GETGMTDATE())"%>
  120.         document.QForm.FMMod.selectedIndex = 3;
  121.     <%case "DATEADD(week, -1, GETGMTDATE())"%>
  122.         document.QForm.FMMod.selectedIndex = 4;
  123.     <%case "DATEADD(month, -1, GETGMTDATE())"%>
  124.         document.QForm.FMMod.selectedIndex = 5;
  125.     <%case "DATEADD(year, -1, GETGMTDATE())"%>
  126.         document.QForm.FMMod.selectedIndex = 6;
  127.     <%case "since"%>
  128.         document.QForm.FMMod.selectedIndex = 7;
  129.     <%case else%>
  130.         document.QForm.FMMod.selectedIndex = 0;
  131.     <%end select%>
  132.  
  133.     document.QForm.FMModDate.value = "<%=FMModDate%>";
  134.  
  135.     document.QForm.DocAuthorRestriction.value = "<%=DocAuthorRestriction%>";
  136. }
  137. //-->
  138. </SCRIPT>
  139.  
  140. <!-- <FORM NAME="QForm" ACTION="advsqlq.asp" METHOD=POST> -->
  141.  
  142. <FORM NAME="QForm" ACTION="advsqlq.asp" METHOD=POST>
  143. <table width=500>
  144.  
  145.     <tr>
  146.         <td>Enter your query: </td>
  147.         <td><INPUT TYPE="TEXT" NAME="SearchString" SIZE="52" MAXLENGTH="100" VALUE=""></td>
  148.     <tr>
  149.  
  150.     <tr>
  151.         <td colspan=2 align=right>Document author: 
  152.                 <INPUT TYPE="TEXT" NAME="DocAuthorRestriction" SIZE="27" MAXLENGTH="100" VALUE="">
  153.     </tr>
  154.     
  155.     <tr>    
  156.         <td colspan=2 align="right">Where File Size is: 
  157.                    <SELECT NAME="FSRest">
  158.                    <!-- <OPTION VALUE=" < " <%if FSRest = " < " then%>SELECTED <%end if%>>Less Than
  159.                         <OPTION VALUE=" > " <%if FSRest = " > " then%>SELECTED <%end if%>>Greater Than
  160.                    -->
  161.                    <OPTION VALUE=" < " SELECTED>Less Than
  162.                    <OPTION VALUE=" > " >Greater Than
  163.                    </SELECT>
  164.  
  165.                    <SELECT NAME="FSRestVal" DEFAULT VALUE="any">
  166.                    <OPTION VALUE="any" SELECTED>any size
  167.                    <OPTION VALUE="100" >100 bytes
  168.                    <OPTION VALUE="1024" >1K bytes
  169.                    <OPTION VALUE="10240" >10K bytes
  170.                    <OPTION VALUE="102400" >100K bytes
  171.                    <OPTION VALUE="1048576" >1M byte
  172.                    <OPTION VALUE="10485760" >10M bytes
  173.                    <OPTION VALUE="104857600" >100M bytes
  174.                    <OPTION VALUE="other" >Other
  175.                    </SELECT>
  176.                    <INPUT TYPE="TEXT" NAME="FSRestOther" SIZE="12" MAXLENGTH="9" VALUE="">
  177.         </td>
  178.     </tr>
  179.  
  180.     <tr>
  181.         <td colspan=2 align="right">Modified:
  182.                 <SELECT NAME="FMMod">
  183.                 <OPTION VALUE="any" SELECTED >at any time.
  184.                 <OPTION VALUE="DATEADD(minute, -10, GETGMTDATE())">in the last 10 minutes.
  185.                 <OPTION VALUE="DATEADD(hour, -1, GETGMTDATE())">in the last hour.
  186.                 <OPTION VALUE="DATEADD(day, -1, GETGMTDATE())">in the last day.
  187.                 <OPTION VALUE="DATEADD(week, -1, GETGMTDATE())">in the last week.
  188.                 <OPTION VALUE="DATEADD(month, -1, GETGMTDATE())">in the last month.
  189.                 <OPTION VALUE="DATEADD(quarter, -1, GETGMTDATE())">in the last quarter.
  190.                 <OPTION VALUE="DATEADD(year, -1, GETGMTDATE())">in the last year.
  191.                 <OPTION VALUE="since">since GMT (yy/mm/dd)        .
  192.                 </SELECT>
  193.                 <INPUT TYPE="TEXT" NAME="FMModDate" SIZE="12" MAXLENGTH="9" VALUE="">
  194.         </td>
  195.     </tr>
  196.      
  197.      <tr>
  198.         <td align=left><a href="ixtipsql.htm">SQL Syntax Tips</a></td>
  199.         <td align=right>
  200.                 <INPUT TYPE="SUBMIT" NAME="Action" VALUE="Execute">
  201.                 <INPUT TYPE="RESET"  NAME="Clear" VALUE="Clear">
  202.         </td>
  203.     </tr>
  204. </table>
  205.         <INPUT TYPE="HIDDEN" NAME="SortBy" VALUE=" order by rank desc">
  206.         <INPUT TYPE="HIDDEN" NAME="ColChoice" VALUE="1">
  207.     
  208. </FORM>
  209.  
  210. <BR>
  211. <%if DebugFlag then%>
  212.     <PRE>
  213.     SearchString         = <%=SearchString%>
  214.     DocAuthorRestriction = <%=DocAuthorRestriction%>
  215.     FSRest               = <%=FSRest%>
  216.     FSRestVal            = <%=FSRestVal%>
  217.     FSRestOther          = <%=FSRestOther%>
  218.     FMMod                = <%=FMMod%>
  219.     FMModDate            = <%=FMModDate%>
  220.     SortBy               = <%=SortBy%>
  221.     Colset               = <%=Colset%>
  222.     NewQuery             = <%=CStr(NewQuery)%>
  223.     </PRE>
  224. <%end if%>
  225.  
  226. <%
  227.  
  228. if NewQuery then
  229.     ' First Reset the Connection, command and recordSet Object.
  230.     set session("AdoConnection") = nothing
  231.     set session("AdoCommand") = nothing
  232.     set session("Recordset") = nothing
  233.     NextRecordNumber = 1
  234.     set AdoConnection = Server.CreateObject("ADODB.Connection")
  235.     set AdoCommand = Server.CreateObject("ADODB.Command")
  236.     AdoConnection.ConnectionString = "provider=msidxs"
  237.     AdoConnection.Open
  238.     set AdoCommand.ActiveConnection = AdoConnection
  239.  
  240.     SelectColumns = "DocTitle, vpath, path, filename, size, write, characterization"
  241.     SelectString = "Select " + SelectColumns + " from Scope() "
  242.  
  243.     Composer = ""
  244.     TheQuery = ""
  245.  
  246.     if SearchString <> "" then
  247.         TheQuery = "contains('""" + SearchString + """')>0"
  248.         Composer = " and "
  249.     end if
  250.  
  251.     if FSRestVal <> "any" then
  252.         if FSRestVal <> "other" then
  253.             if FSRestVal <> "" then
  254.                 TheQuery = "Size " + FSRest + FSRestVal + " " + Composer + TheQuery
  255.             end if
  256.         else    
  257.             TheQuery = "Size " + FSRest + FSRestOther + " " + Composer + TheQuery
  258.         end if
  259.         Composer = " and "
  260.     end if
  261.  
  262.     if DocAuthorRestriction <> "" then
  263.         TheQuery = "Contains(DocAuthor,  '""" + DocAuthorRestriction + """')>0 " + Composer + TheQuery
  264.         Composer = " and "
  265.     end if
  266.  
  267.     if FMMod <> "" AND FMMod <> "any" then
  268.         if FMMod <> "since" then
  269.             TheQuery = "(Write > " + FMMod + ") " + Composer + TheQuery
  270.         else
  271.             TheQuery = "(Write > '" + FMModDate + "') " + Composer + TheQuery
  272.         end if
  273.     end if
  274.  
  275.     if TheQuery <> "" then
  276.         SelectString = SelectString +  " where " + TheQuery +" "+ SortBy
  277.     else
  278.         SelectString = SelectString + SortBy +" "
  279.     end if
  280.  
  281.     AdoCommand.CommandText = SelectString
  282.     set RS = Server.CreateObject("AdoDB.Recordset")
  283.     RS.CursorType = adOpenKeyset
  284.     AdoCommand.Properties("Bookmarkable") = True
  285.     RS.MaxRecords=300
  286.     RS.Open AdoCommand
  287.     RS.PageSize = 10
  288.     ActiveQuery = TRUE
  289.     %>
  290.     <!-- BEGIN column header -->
  291.     <%
  292. elseif UseSavedQuery then 
  293.     if IsObject( Session("AdoConnection") ) And IsObject( Session("AdoCommand")) AND IsObject( Session("RecordSet") ) then
  294.         set AdoConnection = Session("AdoConnection")
  295.         set AdoCommand = Session("AdoCommand")
  296.         set RS = Session("RecordSet")
  297.         if RS.RecordCount <> -1 and NextPageNumber <> -1 then
  298.             RS.AbsolutePage = NextPageNumber
  299.             NextRecordNumber = RS.AbsolutePosition
  300.         end if
  301.         ActiveQuery = TRUE
  302.     else
  303.         Response.Write "ERROR - No saved query"
  304.     end if
  305. end if 
  306. %>
  307.  
  308. <!-- BEGIN first row of query results table -->
  309. <%
  310. if ActiveQuery then
  311.     if not RS.EOF then
  312.         LastRecordOnPage = NextRecordNumber + RS.PageSize - 1
  313.         CurrentPage = RS.AbsolutePage
  314.         if RS.RecordCount <> -1 AND RS.RecordCount < LastRecordOnPage then
  315.             LastRecordOnPage = RS.RecordCount
  316.         end if
  317.  
  318.         Response.Write "Documents " & NextRecordNumber & " to " & LastRecordOnPage
  319.         if RS.RecordCount <> -1 then
  320.             Response.Write " of " & RS.RecordCount
  321.         end if
  322.  
  323.         Response.Write " matching the query: " 
  324.         Response.Write "<P>" & chr(34) & AdoCommand.CommandText & "</I>" & chr(34) & ".<P>"
  325.  
  326. %>
  327. <TABLE width=500>
  328. <%
  329.         Do While Not RS.EOF and NextRecordNumber <= LastRecordOnPage %>
  330.             
  331.             <%
  332.             ' This is the detail portion for Title, Abstract, URL, Size, and
  333.             ' Modification Date.
  334.             ' If there is a title, display it, otherwise display the virtual path.
  335.             %>
  336.     <tr class="RecordTitle">
  337.         <td align="right" valign="top" bgcolor=#FFFFFF>
  338.             <%= NextRecordNumber%>.
  339.         </td>
  340.         <td><b class="RecordTitle">
  341.             <%if VarType(RS("DocTitle")) = 1 or RS("DocTitle") = "" then%>
  342.             <b><a href="<%=RS("vpath")%>"><%= Server.HTMLEncode( RS("filename") )%></a></b>
  343.             <%else%>
  344.                 <b><a href="<%=RS("vpath")%>"><%= Server.HTMLEncode(RS("DocTitle"))%></a></b>
  345.             <%end if%>
  346.         </td>
  347.     </tr>
  348.     <tr>
  349.         <td></td>
  350.         <td>
  351.             <%if VarType(RS("characterization")) = 8 and RS("characterization") <> "" then%>
  352.                 <b><i>Abstract:  </I></b><%= Server.HTMLEncode(RS("characterization"))%>
  353.                 <br>
  354.             <%end if%>
  355.         </td>
  356.     </tr>
  357.     <tr>
  358.         <td></td>
  359.         <td class=RecordStats height=40>
  360.             <a href="<%=RS("vpath")%>" class="RecordStats" style="color:blue;">http://<%=Request("server_name")%><%=RS("vpath")%></a>
  361.                 <br><%if RS("size") = "" then%>(size and time unknown)<%else%>size <%=RS("size")%> bytes - <%=RS("write")%> GMT<%end if%></font>
  362.             
  363.             <%if SearchString <> "" then%>
  364.                 <%
  365.                 QueryString = CStr(RS.Properties("Query Restriction"))
  366.                 %>
  367.                 <BR>
  368.                 <%
  369.                 ' Construct the URL for hit highlighting
  370.  
  371.                 WebHitsQuery = "CiWebHitsFile=" & Server.URLEncode( RS("vpath") )
  372.                 WebHitsQuery = WebHitsQuery & "&CiRestriction=" & Server.URLEncode( QueryString )
  373.                 WebHitsQuery = WebHitsQuery & "&CiBeginHilite=" & Server.URLEncode( "<font color=""#FF0000""><b><em>" )
  374.                 WebHitsQuery = WebHitsQuery & "&CiEndHilite=" & Server.URLEncode( "</em></b></font>" )
  375.                 WebHitsQuery = WebHitsQuery & "&CiUserParam3=" & QueryForm
  376.                 %>
  377.                 <a href="oop/qsumrhit.htw?<%= WebHitsQuery %>"><IMG src="hilight.gif" alt="Highlight matching terms in document using Summary mode."> Summary</a>
  378.                 <a href="oop/qfullhit.htw?<%= WebHitsQuery %>&CiHiliteType=Full"><IMG src="hilight.gif" alt="Highlight matching terms in document."> Full</a>
  379.             <%end if%>
  380.             <br>
  381.         </td>
  382.     </tr>
  383.  
  384.             <%
  385.             RS.MoveNext
  386.             NextRecordNumber = NextRecordNumber+1
  387.         Loop
  388.         %>
  389. </TABLE>
  390.         <%
  391.     else 
  392.        if NextRecordNumber = 1 then
  393.            Response.Write "No documents matched the query<P>"
  394.        else
  395.            Response.Write "No more documents in the query<P>"
  396.        end if
  397.     end if ' NOT RS.EOF
  398.         %>
  399.  
  400.     <!-- If the index is out of date, display the fact -->
  401.     <%if GetCiOutofDate(RS.Properties("Rowset Query Status")) then%>
  402.     <P><I><B>The index is out of date.</B></I>
  403.     <%end if%>
  404.  
  405.         <!--
  406.             If the query was not executed because it needed to enumerate to
  407.             resolve the query instead of using the index, but AllowEnumeration
  408.             was FALSE, let the user know
  409.         -->
  410.  
  411.     <%if GetCiQueryIncomplete(RS.Properties("Rowset Query Status")) then%>
  412.     <P><I><B>The query is too expensive to complete.</B></I>
  413.     <%end if%>
  414.  
  415.         <!--
  416.             If the query took too long to execute (for example, if too much work
  417.             was required to resolve the query), let the user know
  418.         -->
  419.  
  420.     <%if GetCiQueryTimedOut(RS.Properties("Rowset Query Status")) then%>
  421.     <P><I><B>The query took too long to complete.</B></I>
  422.     <%end if%>
  423. <TABLE>
  424. <!--
  425.     This is the "previous" button.
  426.     This retrieves the previous page of documents for the query.
  427. -->
  428. <%SaveQuery = FALSE%>
  429. <%if CurrentPage > 1 and RS.RecordCount <> -1 then ' BUGBUG - use RS.Supports(adMovePrevious)%>
  430.     <td align=left>
  431.         <form action="<%=QueryForm%>" method="post">
  432.            <INPUT TYPE="HIDDEN" NAME="SearchString" VALUE="<%=SearchString%>">
  433.            <INPUT TYPE="HIDDEN" NAME="DocAuthorRestriction"  VALUE="<%=DocAuthorRestriction%>">
  434.            <INPUT TYPE="HIDDEN" NAME="FSRest" VALUE="<%=FSRest%>">
  435.            <INPUT TYPE="HIDDEN" NAME="FSRestVal" VALUE="<%=FSRestVal%>">
  436.            <INPUT TYPE="HIDDEN" NAME="FSRestOther" VALUE="<%=FSRestOther%>">
  437.            <INPUT TYPE="HIDDEN" NAME="FMMod" VALUE="<%=FMMod%>">
  438.            <INPUT TYPE="HIDDEN" NAME="FMModDate" VALUE="<%=FMModDate%>">
  439.            <INPUT TYPE="HIDDEN" NAME="SortBy" VALUE="<%=SortBy%>">
  440.            <INPUT TYPE="HIDDEN" NAME="Colset" VALUE="<%=ColChoice%>">
  441.            <INPUT TYPE="HIDDEN" NAME="Scope" VALUE="<%=Scope%>">
  442.            <INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage-1%>" >
  443.  
  444.            <input type="submit" value="Previous <%=RS.PageSize%> documents">
  445.         </form>
  446.     </td>
  447.     <%SaveQuery = TRUE%>
  448. <%end if%>
  449.  
  450. <!--
  451.     This is the "next" button.
  452.     This button retrieves the next page of documents for the query.
  453. -->
  454. <%if Not RS.EOF then%>
  455.     <td align=right>
  456.         <form action="<%=QueryForm%>" method="post">
  457.  
  458.            <INPUT TYPE="HIDDEN" NAME="SearchString" VALUE="<%=SearchString%>">
  459.            <INPUT TYPE="HIDDEN" NAME="DocAuthorRestriction"  VALUE="<%=DocAuthorRestriction%>">
  460.            <INPUT TYPE="HIDDEN" NAME="FSRest" VALUE="<%=FSRest%>">
  461.            <INPUT TYPE="HIDDEN" NAME="FSRestVal" VALUE="<%=FSRestVal%>">
  462.            <INPUT TYPE="HIDDEN" NAME="FSRestOther" VALUE="<%=FSRestOther%>">
  463.            <INPUT TYPE="HIDDEN" NAME="FMMod" VALUE="<%=FMMod%>">
  464.            <INPUT TYPE="HIDDEN" NAME="FMModDate" VALUE="<%=FMModDate%>">
  465.            <INPUT TYPE="HIDDEN" NAME="SortBy" VALUE="<%=SortBy%>">
  466.            <INPUT TYPE="HIDDEN" NAME="Colset" VALUE="<%=ColChoice%>">
  467.            <INPUT TYPE="HIDDEN" NAME="Scope" VALUE="<%=Scope%>">
  468.            <INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage+1%>" >
  469.  
  470.             <% NextString = "Next "
  471.                if RS.RecordCount <> -1 then
  472.                    NextSet = (RS.RecordCount - NextRecordNumber) + 1
  473.                    if NextSet > RS.PageSize then
  474.                        NextSet = RS.PageSize
  475.                    end if
  476.                    NextString = NextString & NextSet & " documents"
  477.                else
  478.                    NextString = NextString & " page of documents"
  479.                end if
  480.              %>
  481.             <input type="submit" value="<%=NextString%>">
  482.         </form>
  483.     </td>
  484.     <%SaveQuery = TRUE%>
  485. <%end if%>
  486. </TABLE>
  487.  
  488.  
  489. <!-- Display the page number -->
  490.  
  491. Page <%=CurrentPage%>
  492. <%
  493.     if RS.PageCount <> -1 then
  494.         Response.Write " of " & RS.PageCount
  495.     end if 
  496.  
  497.     ' If either of the previous or back buttons were displayed, save 
  498.     ' the query and the recordset in session variables.
  499.     if SaveQuery then
  500.         set Session("AdoConnection") = AdoConnection
  501.         set Session("AdoCommand") = AdoCommand
  502.         set Session("RecordSet") = RS
  503.     else
  504.         RS.close
  505.         AdoConnection.Close
  506.         Set RS = Nothing
  507.         Set AdoCommand = Nothing
  508.         Set AdoConnection = Nothing
  509.         set Session("AdoConnection") = Nothing
  510.         set Session("AdoCommand") = Nothing
  511.         set Session("RecordSet") = Nothing
  512.     end if
  513. end if
  514. %>
  515. <!--#include file ="is2foot.inc"-->                 
  516. </BODY>
  517. </HTML>
  518.