home *** CD-ROM | disk | FTP | other *** search
/ Clickx 75 / Clickx 75.iso / software / expressionweb / expressionwebv3 / ExpressionWeb_en.exe / Setup / WeNoLoc.cab / xweb.FPCLASS.FPDBRGN1.INC < prev    next >
Encoding:
Text File  |  2009-06-09  |  16.7 KB  |  532 lines

  1. <%BeginASP%>
  2.      
  3. FP_SetLocaleForPage
  4.  
  5. ' determine whether or not to provide navigation controls
  6. if fp_iPageSize > 0 then
  7.     fp_fShowNavbar = True
  8. else
  9.     fp_fShowNavbar = False
  10. end if
  11.  
  12. fp_sPagePath = Request.ServerVariables("PATH_INFO")
  13. fp_sEnvKey = fp_sPagePath & "#fpdbr_" & fp_iRegion
  14. fp_sFormName = "fpdbr_" & CStr(fp_iRegion)
  15. fp_sFormKey = fp_sFormName & "_PagingMove"
  16.  
  17. fp_sInputs = fp_sDefault
  18.  
  19. fp_DEBUG = False
  20.  
  21. fp_sFirstLabel = "  |<  "
  22. fp_sPrevLabel  = "   <  "
  23. fp_sNextLabel  = "  >   "
  24. fp_sLastLabel  = "  >|  "
  25. fp_sDashLabel  = "  --  "
  26.  
  27. if not IsEmpty(Request(fp_sFormKey)) then
  28.     fp_sMoveType = Request(fp_sFormKey)
  29. else
  30.     fp_sMoveType = ""
  31. end if
  32.  
  33. fp_iCurrent=1
  34. fp_fError=False
  35. fp_bBlankField=False
  36. Set fp_dictInputs = Server.CreateObject("Scripting.Dictionary")
  37. Set fp_dictParams = Server.CreateObject("Scripting.Dictionary")
  38. Set fp_dictColTypes = Server.CreateObject("Scripting.Dictionary")
  39. fp_iParam = 1
  40.  
  41. fp_sQry = FP_ReplaceQuoteChars(fp_sQry)
  42.  
  43. ' replace any input parameters in query string
  44. ' there need to be at least 5 more characters in the string for there to be input parameters (::[_a-z]::)
  45. Do While (Not fp_fError) And (fp_iCurrent + 5 < Len(fp_sQry) And Instr(fp_iCurrent, fp_sQry, "::") > 0)
  46.     fp_iMax = Len(fp_sQry) + 1
  47.     fp_iColonStart = Instr(fp_iCurrent, fp_sQry, "::")
  48.     fp_iSQuoteStart = Instr(fp_iCurrent, fp_sQry, "'")
  49.     fp_iDQuoteStart = Instr(fp_iCurrent, fp_sQry, """")
  50.     
  51.     If (fp_iSQuoteStart = 0) then
  52.         fp_iSQuoteStart = fp_iMax
  53.     End If
  54.     If (fp_iDQuoteStart = 0) then
  55.         fp_iDQuoteStart = fp_iMax
  56.     End If
  57.     
  58.     fp_sQuoteDelim = ""
  59.     fp_iQuoteStart = -1
  60.     fp_iQuoteEnd = fp_iMax
  61.     fp_bQuoteFound = false
  62.     If (fp_iColonStart > fp_iSQuoteStart and fp_iDQuoteStart > fp_iSQuoteStart) then 'single quote is first sought for character
  63.         fp_sQuoteDelim = "'"
  64.         fp_iQuoteStart = fp_iSQuoteStart
  65.     elseIf (fp_iColonStart > fp_iDQuoteStart and fp_iSQuoteStart > fp_iDQuoteStart) then 'double quote is first sought for character
  66.         fp_sQuoteDelim = """"
  67.         fp_iQuoteStart = fp_iDQuoteStart
  68.     else
  69.         'The :: comes before any ' or "
  70.     End If
  71.  
  72.     If(fp_sQuoteDelim <> "") then
  73.         fp_iPotQuoteEnd = fp_iQuoteStart + 1
  74.         Do While (fp_bQuoteFound = false and fp_iPotQuoteEnd < fp_iMax)
  75.             fp_iPotQuoteEnd = Instr(fp_iPotQuoteEnd, fp_sQry, fp_sQuoteDelim)
  76.  
  77.             If(fp_iPotQuoteEnd = 0) then 
  78.                 exit do
  79.             End If
  80.  
  81.             If(fp_iPotQuoteEnd = fp_iMax - 1) then
  82.                 fp_iQuoteEnd = fp_iPotQuoteEnd
  83.                 fp_bQuoteFound = true
  84.                 exit do
  85.             End If
  86.             
  87.             If(Mid(fp_sQry, fp_iPotQuoteEnd + 1, 1) <> fp_sQuoteDelim) then
  88.                 fp_iQuoteEnd = fp_iPotQuoteEnd
  89.                 fp_bQuoteFound = true
  90.             else
  91.                 fp_iPotQuoteEnd = fp_iPotQuoteEnd + 2
  92.             End If
  93.         Loop
  94.         
  95.         If(fp_bQuoteFound = false) then
  96.             Err.Description = "<%IDS_DBREGION_ASP_ERROR_NO_MATCH_QUOTE%>"
  97.             fp_fError = true
  98.             fp_bSkip = true
  99.         End If
  100.         
  101.         If(fp_iColonStart > fp_iQuoteEnd) then 'there is no user input in this literal string
  102.             fp_iCurrent = fp_iQuoteEnd + 1
  103.             fp_bSkip = true
  104.         End If
  105.         
  106.     else
  107.         fp_iQuoteStart = fp_iColonStart
  108.         fp_bQuoteFound = false
  109.     End If
  110.     
  111.     If not fp_bSkip then
  112.         fp_iStart = fp_iColonStart
  113.         ' found a opening ::, find the close ::
  114.         fp_iEnd = InStr(fp_iStart + 2, fp_sQry, "::")
  115.     
  116.         If not fp_bQuoteFound then
  117.             fp_iQuoteEnd = fp_iEnd + 1
  118.         End If
  119.         If fp_iEnd = 0 Then
  120.             fp_fError = True
  121.             Response.Write "<%IDS_DBREGION_ASP_ERROR_PARAMETER_DELIM%>"
  122.         Else
  123.             fp_sField = Mid(fp_sQry, fp_iStart + 2, fp_iEnd - fp_iStart - 2)
  124.             fp_sValue = Request.Form(fp_sField)
  125.             if len(fp_sValue) = 0 then fp_sValue = Request.QueryString(fp_sField)
  126.  
  127.             ' if the named form field doesn't exist, make a note of it
  128.             If (len(fp_sValue) = 0) Then
  129.                 fp_iStartField = InStr(fp_sDefault, fp_sField & "=")
  130.                 if fp_iStartField > 0 then
  131.                     fp_iStartField = fp_iStartField + len(fp_sField) + 1
  132.                     fp_iEndField = InStr(fp_iStartField,fp_sDefault,"&")
  133.                     if fp_iEndField > 0 then
  134.                         fp_sValue = Mid(fp_sDefault,fp_iStartField,fp_iEndField - fp_iStartField)
  135.                     else
  136.                         fp_sValue = Mid(fp_sDefault,fp_iStartField)
  137.                     end if
  138.                 end if
  139.             End If
  140.     
  141.             ' remember names and values used in query
  142.             if not fp_dictInputs.Exists(fp_sField) then
  143.                 fp_dictInputs.Add fp_sField, fp_sValue
  144.             end if
  145.         
  146.             if (len(fp_sValue) = 0) Then fp_bBlankField = True
  147.             
  148.             fp_iOpEnd = fp_iQuoteStart - 1
  149.         
  150.             Do While (Mid (fp_sQry , fp_iOpEnd , 1) = " ")
  151.                 fp_iOpEnd = fp_iOpEnd - 1
  152.             Loop
  153.         
  154.             fp_iFieldEnd = fp_iOpEnd
  155.             If ( Mid(fp_sQry, fp_iOpEnd - 1, 2) = "<=") then
  156.                 fp_iFieldEnd = fp_iOpEnd - 2
  157.             ElseIf (Mid(fp_sQry, fp_iOpEnd - 1, 2) = ">=") then
  158.                 fp_iFieldEnd = fp_iOpEnd - 2
  159.             ElseIf (Mid(fp_sQry, fp_iOpEnd - 1, 2) = "<>") then
  160.                 fp_iFieldEnd = fp_iOpEnd - 2
  161.             ElseIf (UCase(Mid(fp_sQry, fp_iOpEnd - 3, 4)) = "LIKE" ) then
  162.                 fp_iFieldEnd = fp_iOpEnd - 4
  163.             ElseIf (Mid(fp_sQry, fp_iOpEnd, 1) = "=") then
  164.                 fp_iFieldEnd = fp_iOpEnd - 1
  165.             ElseIf (Mid(fp_sQry, fp_iOpEnd, 1) = "<") then
  166.                 fp_iFieldEnd = fp_iOpEnd - 1
  167.             ElseIf (Mid(fp_sQry, fp_iOpEnd, 1) = ">") then
  168.                 fp_iFieldEnd = fp_iOpEnd - 1
  169.             End If
  170.         
  171.             If(fp_iFieldEnd <> fp_iOpEnd) Then
  172.                 Do While (fp_iFieldEnd) > 0 and (Mid(fp_sQry,fp_iFieldEnd,1) = " ")
  173.                     fp_iFieldEnd = fp_iFieldEnd - 1
  174.                 Loop
  175.                 fp_colNameDelim = ""
  176.             
  177.                 If(fp_iFieldEnd) > 0 then
  178.                     fp_sTemp = Mid(fp_sQry,fp_iFieldEnd,1)
  179.  
  180.                     If(InStr("])""",fp_sTemp)) then
  181.                         If(InStr("]",fp_sTemp)) then
  182.                             fp_colNameDelim = ".["
  183.                         ElseIf (InStr(")",fp_sTemp)) then
  184.                             fp_colNameDelim = ".("
  185.                         ElseIf (InStr("""",fp_sTemp)) then
  186.                             fp_colNameDelim = "."""
  187.                     End If
  188.                         'In the End, we ignore the 'quote' character
  189.                     fp_iFieldEnd = fp_iFieldEnd - 1
  190.                 End If
  191.             End If
  192.                    
  193.             fp_iFieldStart = fp_iFieldEnd
  194.             If (fp_colNameDelim = "") then
  195.                 fp_colNameDelim = " (."
  196.             End If
  197.             
  198.             DO while (fp_iFieldStart > 0 and InStr(fp_colNameDelim, Mid(fp_sQry,fp_iFieldStart,1)) = 0) 
  199.                 fp_iFieldStart = fp_iFieldStart - 1
  200.             Loop
  201.             
  202.             fp_iFieldStart = fp_iFieldStart + 1
  203.     
  204.             fp_sColName = Mid(fp_sQry, fp_iFieldStart, fp_iFieldEnd - fp_iFieldStart + 1)
  205.             
  206.             If( "NOT" = UCase(fp_sColName)) then
  207.                 fp_iFieldEnd = fp_iFieldStart - 1
  208.                 Do While (fp_iFieldEnd) > 0 and (Mid(fp_sQry,fp_iFieldEnd,1) = " ")
  209.                     fp_iFieldEnd = fp_iFieldEnd - 1
  210.                 Loop
  211.             
  212.                 fp_colNameDelim = ""
  213.                 
  214.                 If(fp_iFieldEnd) > 0 then
  215.                    fp_sTemp = Mid(fp_sQry,fp_iFieldEnd,1)
  216.     
  217.                     If(InStr("])""",fp_sTemp)) then
  218.                         If(InStr("]",fp_sTemp)) then
  219.                                fp_colNameDelim = ".["
  220.                         ElseIf (InStr(")",fp_sTemp)) then
  221.                             fp_colNameDelim = ".("
  222.                         ElseIf (InStr("""",fp_sTemp)) then
  223.                             fp_colNameDelim = "."""
  224.                         End If
  225.                         'In the End, we ignore the 'quote' character
  226.                         fp_iFieldEnd = fp_iFieldEnd - 1
  227.                     End If
  228.                 End If
  229.                        
  230.                 fp_iFieldStart = fp_iFieldEnd
  231.                 If(fp_colNameDelim = "") Then
  232.                     fp_colNameDelim = " (."
  233.                 End If
  234.                 
  235.                 Do while (fp_iFieldStart > 0 and InStr(fp_colNameDelim, Mid(fp_sQry,fp_iFieldStart,1)) = 0) 
  236.                     fp_iFieldStart = fp_iFieldStart - 1
  237.                 Loop            
  238.                 fp_iFieldStart = fp_iFieldStart + 1
  239.  
  240.                 fp_sColName = Mid(fp_sQry, fp_iFieldStart, fp_iFieldEnd - fp_iFieldStart + 1)
  241.             End If
  242.  
  243.             fp_sColName = Replace(fp_sColName, "[", "")
  244.             fp_sColName = Replace(fp_sColName, "]", "")
  245.  
  246.             fp_colType = ""
  247.             fp_iStartField = InStr(fp_sColTypes, "&" & fp_sColName & "=")
  248.             If fp_iStartField > 0 Then
  249.                 fp_iStartField = fp_iStartField + len(fp_sColName) + 2
  250.                 fp_iEndField = InStr(fp_iStartField,fp_sColTypes,"&")
  251.                 If fp_iEndField > 0 Then
  252.                     fp_colType = Mid(fp_sColTypes,fp_iStartField,fp_iEndField - fp_iStartField)
  253.                 else
  254.                     Err.Description = "<%IDS_DBREGION_ASP_ERROR_MALFORMED_COL_TYPES%>"
  255.                     Err.Description = Err.Description & "<%IDS_DBREGION_ASP_ERROR_READKB%>"
  256.                     fp_fError = true
  257.                 End If
  258.             End If
  259.  
  260.             If(Len(fp_colType) > 0 and IsNumeric(fp_colType)) Then
  261.                 fp_dictColTypes.Add fp_iParam, fp_colType
  262.                 
  263.                 'Remove single quotes around strings
  264.                 select case fp_colType
  265.                     case 129, 200, 201, 130, 202, 203 ' adChar, adVarChar, adLongVarChar, adWChar, adVarWChar, adLongVarWChar
  266.                         If not fp_bQuoteFound and Left(fp_sValue, 1) = "'" or Left(fp_sValue, 1) = """" Then
  267.                             fp_sValue = Mid(fp_sValue,2,Len(fp_sValue)-2)        
  268.                         End If
  269.                     case else
  270.                         ' do nothing
  271.                 End select
  272.                 
  273.                 If fp_sQuoteDelim =  """"  Then
  274.                     fp_sValue = Replace(fp_sValue, """""", """")
  275.                 ElseIf fp_sQuoteDelim = "'" Then
  276.                     fp_sValue = Replace(fp_sValue, "''", "'")
  277.                 End If
  278.  
  279.                 If (fp_bQuoteFound) then
  280.                     fp_sLead = Mid(fp_sQry, fp_iQuoteStart + 1, fp_iColonStart - fp_iQuoteStart -1)
  281.                     fp_sTail = Mid(fp_sQry, fp_iEnd + 2, fp_iQuoteEnd - fp_iEnd - 2)
  282.                     If fp_sQuoteDelim =  """"  Then
  283.                         fp_sLead = Replace(fp_sLead, """""", """")
  284.                         fp_sTail = Replace(fp_sTail, """""", """")
  285.                     ElseIf fp_sQuoteDelim = "'" Then
  286.                         fp_sLead = Replace(fp_sLead, "''", "'")
  287.                         fp_sTail = Replace(fp_sTail, "''", "'")
  288.                     End If
  289.                     
  290.                     fp_sValue = fp_sLead & fp_sValue & fp_sTail
  291.                 End If
  292.                 
  293.                 fp_dictParams.Add fp_iParam, fp_sValue
  294.                 fp_iParam = fp_iParam + 1
  295.                 fp_sValue = "?"    
  296.             else
  297.             ' this next finds the named form field value, and substitutes in
  298.             ' doubled single-quotes for all single quotes in the literal value
  299.             ' so that SQL doesn't get confused by seeing unpaired single-quotes
  300.                 Err.Description = "<%IDS_DBREGION_ASP_ERROR_NO_RESOLVE_PARAMS%>" 
  301.                 Err.Description = Err.Description & "<%IDS_DBREGION_ASP_ERROR_READKB%>"
  302.                 fp_fError = True
  303.             End If
  304.             
  305.             If((Len(fp_sQry) - fp_iQuoteEnd) < 1) then
  306.                 fp_sQry = Left(fp_sQry, fp_iQuoteStart - 1) & "?"
  307.             else
  308.                 fp_sQry = Left(fp_sQry, fp_iQuoteStart - 1) & "?" & Right(fp_sQry, Len(fp_sQry) - fp_iQuoteEnd)
  309.             End If
  310.         ElseIf (LCase(Mid(fp_sQry, fp_iOpEnd - 1, 2)) = "by") then
  311.             fp_iFieldEnd = fp_iOpEnd - 2
  312.             Do While (fp_iFieldEnd) > 0 and (Mid(fp_sQry,fp_iFieldEnd,1) = " ")
  313.                 fp_iFieldEnd = fp_iFieldEnd - 1
  314.             Loop
  315.  
  316.             If (LCase(Mid(fp_sQry, fp_iFieldEnd - 4, 5)) = "order") then
  317.                 ' only accept column names as parameters
  318.                 If(InStr(1, fp_sColTypes, "&" & fp_sValue & "=", 1)) then
  319.                     If((Len(fp_sQry) - fp_iQuoteEnd) < 1) then
  320.                         fp_sQry = Left(fp_sQry, fp_iQuoteStart - 1) & fp_sValue
  321.                     else
  322.                         fp_sQry = Left(fp_sQry, fp_iQuoteStart - 1) & fp_sValue & Right(fp_sQry, Len(fp_sQry) - fp_iQuoteEnd)
  323.                     End If
  324.                 Else
  325.                     fp_fError=True
  326.                     Err.Description = "<%IDS_DBREGION_ERROR_DEFAULT_MESSAGE%>"
  327.                 End If    
  328.             Else
  329.                 fp_fError=True
  330.                 Err.Description = <%IDS_DBREGION_ASP_ERROR_OP_NOT_FOUND%>
  331.             End If
  332.         Else
  333.             fp_fError=True
  334.             Err.Description = <%IDS_DBREGION_ASP_ERROR_OP_NOT_FOUND%>
  335.         End If
  336.         
  337.         ' Fixup the new current position to be after the substituted value
  338.         fp_iCurrent = fp_iQuoteStart + 1
  339.     End If
  340.     End If 
  341.     fp_bSkip = false
  342. Loop
  343.  
  344. ' establish connection
  345. If Not fp_fError Then
  346.     if Application(fp_sDataConn & "_ConnectionString") = "" then
  347.         if fp_DEBUG Then
  348.             Err.Description = "<%IDS_DBREGION_ASP_ERROR_CONN_ERR%>"
  349.         else 
  350.             Err.Description = "<%IDS_DBREGION_ERROR_DEFAULT_MESSAGE%>"
  351.         end if    
  352.         fp_fError = True
  353.     end if
  354.     if Not fp_fError then
  355.         set fp_conn = Server.CreateObject("ADODB.Connection")
  356.         fp_conn.ConnectionTimeout = Application(fp_sDataConn & "_ConnectionTimeout")
  357.         fp_conn.CommandTimeout = Application(fp_sDataConn & "_CommandTimeout")
  358.         fp_sConn = Application(fp_sDataConn & "_ConnectionString")
  359.         fp_sUid = Application(fp_sDataConn & "_RuntimeUserName")
  360.         fp_sPwd = Application(fp_sDataConn & "_RuntimePassword")
  361.         Err.Clear
  362.         FP_OpenConnection fp_conn, fp_sConn, fp_sUid, fp_sPwd, Not(fp_fCustomQuery)
  363.         if Err.Description <> "" then fp_fError = True
  364.     end if
  365.     if Not fp_fError then
  366.         set fp_cmd = Server.CreateObject("ADODB.Command")
  367.         fp_cmd.CommandText = fp_sQry
  368.         fp_cmd.CommandType = fp_iCommandType
  369.         fp_cmd.CommandTimeout = fp_conn.CommandTimeout
  370.         set fp_cmd.ActiveConnection = fp_conn
  371.         set fp_rs = Server.CreateObject("ADODB.Recordset")
  372.         set fp_rs.Source = fp_cmd
  373.         
  374.         On Error Resume Next
  375.         fp_iTemp = 1
  376.         Do While fp_iTemp < fp_iParam
  377.             fp_colType = fp_dictColTypes.Item(fp_iTemp)
  378.             fp_colValue = fp_dictParams.Item(fp_iTemp)
  379.             
  380.             select case fp_colType 
  381.                 case 129, 200, 201, 130, 202, 203 ' adChar, adVarChar, adLongVarChar, adWChar, adVarWChar, adLongVarWChar
  382.                     fp_cmd.Parameters.Append = fp_cmd.CreateParameter("Field"&fp_iTemp, fp_colType, 1, Len(fp_colValue) + 1)        
  383.                 case else
  384.                     fp_cmd.Parameters.Append = fp_cmd.CreateParameter("Field"&fp_iTemp, fp_colType, 1 )        
  385.             end select
  386.             fp_cmd.Parameters("Field"&fp_iTemp).Value = fp_colValue
  387.             fp_iTemp = fp_iTemp + 1
  388.         LOOP
  389.         On Error Goto 0
  390.         
  391.         If fp_iCommandType = 4 Then
  392.             fp_cmd.Parameters.Refresh
  393.             Do Until Len(fp_sInputs) = 0
  394.                 fp_iLoc = InStr(fp_sInputs,"=")
  395.                 if fp_iLoc = 0 then exit do
  396.                 fp_sKey = Left(fp_sInputs,fp_iLoc - 1)
  397.                 fp_sInputs = Mid(fp_sInputs,fp_iLoc + 1)
  398.                 fp_iLoc = InStr(fp_sInputs,"&")
  399.                 if fp_iLoc = 0 then
  400.                     fp_sInpVal = fp_sInputs
  401.                     fp_sInputs = ""
  402.                 else
  403.                     fp_sInpVal = Left(fp_sInputs,fp_iLoc - 1)
  404.                     fp_sInputs = Mid(fp_sInputs,fp_iLoc + 1)
  405.                 end if            
  406.                 fp_sVal = Request.Form(fp_sKey)
  407.                 if len(fp_sVal) = 0 then fp_sVal = Request.QueryString(fp_sKey)
  408.                 if len(fp_sVal) = 0 then fp_sVal = fp_sInpVal
  409.                 fp_pType = fp_cmd.Parameters(fp_sKey).Type
  410.                 select case fp_pType
  411.                     case 129, 200, 201, 130, 202, 203 ' adChar, adVarChar, adLongVarChar, adWChar, adVarWChar, adLongVarWChar
  412.                         fp_cmd.Parameters(fp_sKey).Size = Len(fp_sVal) + 1
  413.                     case else
  414.                         ' do nothing
  415.                 end select
  416.  
  417.                 ' remember names and values used in query
  418.                 if not fp_dictInputs.Exists(fp_sKey) then
  419.                     fp_dictInputs.Add fp_sKey, fp_sVal
  420.                 end if
  421.  
  422.                 fp_cmd.Parameters(fp_sKey) = fp_sVal
  423.             Loop
  424.         End If
  425.         If fp_iMaxRecords <> 0 Then fp_rs.MaxRecords = fp_iMaxRecords
  426.  
  427.         FP_SetCursorProperties(fp_rs)
  428.  
  429.         FP_OpenRecordset(fp_rs)
  430.     end if
  431.  
  432.     if(Err.Description = ""    ) then
  433.         ' Check for the no-record case
  434.         if fp_rs.State <> 1 then
  435.             fp_fError = True
  436.             Response.Write fp_sNoRecords
  437.         ElseIf fp_rs.EOF And fp_rs.BOF Then
  438.             fp_fError = True
  439.             Response.Write fp_sNoRecords
  440.         end if
  441.     end if
  442. end if
  443.  
  444. If Err.Description <> "" Then
  445.     if fp_fTableFormat then
  446.         Response.Write "<tr><td colspan=" & fp_iDisplayCols & " color=#000000 bgcolor=#ffff00>"
  447.     end if
  448.     Response.Write "<tt>"
  449.     Response.Write "<b><%IDS_DBREGION_ASP_ERROR_HEADER%></b><br>"
  450.     if fp_DEBUG Then
  451.         if Not fp_fError Then
  452.                 Response.Write "<%IDS_DBREGION_ASP_ERROR_DESCRIPTION%>" & Server.HtmlEncode(Err.Description) & "<br>"
  453.                 Response.Write "<%IDS_DBREGION_ASP_ERROR_NUMBER%>" & Server.HtmlEncode(Err.Number) & " (0x" & Hex(Err.Number) & ")<br>"
  454.                 Response.Write "<%IDS_DBREGION_ASP_ERROR_SOURCE%>" & Server.HtmlEncode(Err.Source) & "<br>"
  455.         else
  456.             Response.Write Err.Description
  457.         end if
  458.         if fp_bBlankField Then
  459.             Response.Write "<%IDS_DBREGION_ASP_ERROR_BLANK_FIELD%>"
  460.         end if
  461.     else
  462.             Response.Write "<%IDS_DBREGION_ERROR_DEFAULT_MESSAGE%>"
  463.     end if
  464.     Response.Write "</tt>"
  465.     if fp_fTableFormat then
  466.         Response.Write "</td></tr>"
  467.     end if
  468.     fp_fError = True
  469. end if    
  470.  
  471.  
  472.  
  473. ' determine whether or not provider supports Absolute Positioning
  474. if not fp_fError then
  475.     if IsObject(fp_rs) and not(fp_rs.Supports(&H00004000)) then 
  476.         fp_iPageSize = 0
  477.         fp_fShowNavbar = False
  478.     end if
  479. end if
  480.  
  481. ' move to correct position in result set
  482. if not fp_fError then
  483.  
  484.     if fp_iPageSize > 0 then
  485.         fp_iAbsPage = 1
  486.         fp_sVal = Session(fp_sEnvKey)
  487.         if fp_sVal <> "" then 
  488.             fp_iAbsPage = CInt(fp_sVal)
  489.         end if
  490.  
  491.         fp_rs.PageSize = fp_iPageSize
  492.         if fp_iAbsPage > fp_rs.PageCount then fp_iAbsPage = fp_rs.PageCount
  493.         fp_rs.AbsolutePage = fp_iAbsPage
  494.         if fp_rs.PageCount = 1 then fp_fShowNavbar = False
  495.  
  496.         select case fp_sMoveType
  497.             case ""
  498.                 ' do nothing
  499.             case fp_sFirstLabel
  500.                 fp_rs.AbsolutePage = 1
  501.             case fp_sPrevLabel
  502.                 if fp_rs.AbsolutePage > 1 then fp_rs.AbsolutePage = fp_rs.AbsolutePage - 1
  503.             case fp_sNextLabel
  504.                 if fp_rs.AbsolutePage < fp_rs.PageCount then fp_rs.AbsolutePage = fp_rs.AbsolutePage + 1
  505.             case fp_sLastLabel
  506.                 fp_rs.AbsolutePage = fp_rs.PageCount
  507.             case else
  508.                 ' do nothing
  509.         end select
  510.  
  511.         fp_iAbsPage = fp_rs.AbsolutePage
  512.         Session(fp_sEnvKey) = fp_iAbsPage
  513.     end if
  514.  
  515. end if
  516.  
  517. if fp_fError then fp_fShowNavbar = False
  518.  
  519. fp_iCount = 0
  520. Do
  521.     if fp_fError then exit do
  522.     if fp_rs.EOF then exit do
  523.     if fp_iPageSize > 0 And fp_iCount >= fp_rs.PageSize then exit do
  524.     if fp_iMaxRecords > 0 And fp_iCount >= fp_iMaxRecords then 
  525.     ' MaxRecords didn't work; exit loop
  526.     fp_fShowNavbar = False
  527.     exit do
  528.     end if
  529. <%EndASP%>
  530.  
  531.  
  532.