greenelephant
05 Aug 2009, 05:26 PM
Hello everyone. I've just used Front Page 2003 to create a form to database website using database Interface Wizard. and am using IIS6.0 on Win XP
I am having difficulty add or deleting any records from my database using database editor or submission. I can view them OK if I add records in myself directly into the database using MS Access. I have been to fpdbrgn1 may be suspect. is it true? here is my coding
<%
FP_SetLocaleForPage
' determine whether or not to provide navigation controls
if fp_iPageSize > 0 then
fp_fShowNavbar = True
else
fp_fShowNavbar = False
end if
fp_sPagePath = Request.ServerVariables("PATH_INFO")
fp_sEnvKey = fp_sPagePath & "#fpdbr_" & fp_iRegion
fp_sFormName = "fpdbr_" & CStr(fp_iRegion)
fp_sFormKey = fp_sFormName & "_PagingMove"
fp_sInputs = fp_sDefault
fp_DEBUG = True
fp_sFirstLabel = " |< "
fp_sPrevLabel = " < "
fp_sNextLabel = " > "
fp_sLastLabel = " >| "
fp_sDashLabel = " -- "
if not IsEmpty(Request(fp_sFormKey)) then
fp_sMoveType = Request(fp_sFormKey)
else
fp_sMoveType = ""
end if
fp_iCurrent=1
fp_fError=False
fp_bBlankField=False
Set fp_dictInputs = Server.CreateObject("Scripting.Dictionary")
Set fp_dictParams = Server.CreateObject("Scripting.Dictionary")
Set fp_dictColTypes = Server.CreateObject("Scripting.Dictionary")
fp_iParam = 1
fp_sQry = FP_ReplaceQuoteChars(fp_sQry)
' replace any input parameters in query string
' there need to be at least 5 more characters in the string for there to be input parameters (::[_a-z]::)
Do While (Not fp_fError) And (fp_iCurrent + 5 < Len(fp_sQry) And Instr(fp_iCurrent, fp_sQry, "::") > 0)
fp_iMax = Len(fp_sQry) + 1
fp_iColonStart = Instr(fp_iCurrent, fp_sQry, "::")
fp_iSQuoteStart = Instr(fp_iCurrent, fp_sQry, "'")
fp_iDQuoteStart = Instr(fp_iCurrent, fp_sQry, """")
If (fp_iSQuoteStart = 0) then
fp_iSQuoteStart = fp_iMax
End If
If (fp_iDQuoteStart = 0) then
fp_iDQuoteStart = fp_iMax
End If
fp_sQuoteDelim = ""
fp_iQuoteStart = -1
fp_iQuoteEnd = fp_iMax
fp_bQuoteFound = false
If (fp_iColonStart > fp_iSQuoteStart and fp_iDQuoteStart > fp_iSQuoteStart) then 'single quote is first sought for character
fp_sQuoteDelim = "'"
fp_iQuoteStart = fp_iSQuoteStart
elseIf (fp_iColonStart > fp_iDQuoteStart and fp_iSQuoteStart > fp_iDQuoteStart) then 'double quote is first sought for character
fp_sQuoteDelim = """"
fp_iQuoteStart = fp_iDQuoteStart
else
'The :: comes before any ' or "
End If
If(fp_sQuoteDelim <> "") then
fp_iPotQuoteEnd = fp_iQuoteStart + 1
Do While (fp_bQuoteFound = false and fp_iPotQuoteEnd < fp_iMax)
fp_iPotQuoteEnd = Instr(fp_iPotQuoteEnd, fp_sQry, fp_sQuoteDelim)
If(fp_iPotQuoteEnd = 0) then
exit do
End If
If(fp_iPotQuoteEnd = fp_iMax - 1) then
fp_iQuoteEnd = fp_iPotQuoteEnd
fp_bQuoteFound = true
exit do
End If
If(Mid(fp_sQry, fp_iPotQuoteEnd + 1, 1) <> fp_sQuoteDelim) then
fp_iQuoteEnd = fp_iPotQuoteEnd
fp_bQuoteFound = true
else
fp_iPotQuoteEnd = fp_iPotQuoteEnd + 2
End If
Loop
If(fp_bQuoteFound = false) then
Err.Description = "Unable to find a matching quote for " & fp_sQuoteDelim & " in the query."
fp_fError = true
fp_bSkip = true
End If
If(fp_iColonStart > fp_iQuoteEnd) then 'there is no user input in this literal string
fp_iCurrent = fp_iQuoteEnd + 1
fp_bSkip = true
End If
else
fp_iQuoteStart = fp_iColonStart
fp_bQuoteFound = false
End If
If not fp_bSkip then
fp_iStart = fp_iColonStart
' found a opening ::, find the close ::
fp_iEnd = InStr(fp_iStart + 2, fp_sQry, "::")
If not fp_bQuoteFound then
fp_iQuoteEnd = fp_iEnd + 1
End If
If fp_iEnd = 0 Then
fp_fError = True
Response.Write "<B>Database Results Error: mismatched parameter delimiters</B>"
Else
fp_sField = Mid(fp_sQry, fp_iStart + 2, fp_iEnd - fp_iStart - 2)
fp_sValue = Request.Form(fp_sField)
if len(fp_sValue) = 0 then fp_sValue = Request.QueryString(fp_sField)
' if the named form field doesn't exist, make a note of it
If (len(fp_sValue) = 0) Then
fp_iStartField = InStr(fp_sDefault, fp_sField & "=")
if fp_iStartField > 0 then
fp_iStartField = fp_iStartField + len(fp_sField) + 1
fp_iEndField = InStr(fp_iStartField,fp_sDefault,"&")
if fp_iEndField > 0 then
fp_sValue = Mid(fp_sDefault,fp_iStartField,fp_iEndField - fp_iStartField)
else
fp_sValue = Mid(fp_sDefault,fp_iStartField)
end if
end if
End If
' remember names and values used in query
if not fp_dictInputs.Exists(fp_sField) then
fp_dictInputs.Add fp_sField, fp_sValue
end if
if (len(fp_sValue) = 0) Then fp_bBlankField = True
fp_iOpEnd = fp_iQuoteStart - 1
Do While (Mid (fp_sQry , fp_iOpEnd , 1) = " ")
fp_iOpEnd = fp_iOpEnd - 1
Loop
fp_iFieldEnd = fp_iOpEnd
If ( Mid(fp_sQry, fp_iOpEnd - 1, 2) = "<=") then
fp_iFieldEnd = fp_iOpEnd - 2
ElseIf (Mid(fp_sQry, fp_iOpEnd - 1, 2) = ">=") then
fp_iFieldEnd = fp_iOpEnd - 2
ElseIf (Mid(fp_sQry, fp_iOpEnd - 1, 2) = "<>") then
fp_iFieldEnd = fp_iOpEnd - 2
ElseIf (UCase(Mid(fp_sQry, fp_iOpEnd - 3, 4)) = "LIKE" ) then
fp_iFieldEnd = fp_iOpEnd - 4
ElseIf (Mid(fp_sQry, fp_iOpEnd, 1) = "=") then
fp_iFieldEnd = fp_iOpEnd - 1
ElseIf (Mid(fp_sQry, fp_iOpEnd, 1) = "<") then
fp_iFieldEnd = fp_iOpEnd - 1
ElseIf (Mid(fp_sQry, fp_iOpEnd, 1) = ">") then
fp_iFieldEnd = fp_iOpEnd - 1
End If
If(fp_iFieldEnd <> fp_iOpEnd) Then
Do While (fp_iFieldEnd) > 0 and (Mid(fp_sQry,fp_iFieldEnd,1) = " ")
fp_iFieldEnd = fp_iFieldEnd - 1
Loop
fp_colNameDelim = ""
If(fp_iFieldEnd) > 0 then
fp_sTemp = Mid(fp_sQry,fp_iFieldEnd,1)
If(InStr("])""",fp_sTemp)) then
If(InStr("]",fp_sTemp)) then
fp_colNameDelim = ".["
ElseIf (InStr(")",fp_sTemp)) then
fp_colNameDelim = ".("
ElseIf (InStr("""",fp_sTemp)) then
fp_colNameDelim = "."""
End If
'In the End, we ignore the 'quote' character
fp_iFieldEnd = fp_iFieldEnd - 1
End If
End If
fp_iFieldStart = fp_iFieldEnd
If (fp_colNameDelim = "") then
fp_colNameDelim = " (."
End If
DO while (fp_iFieldStart > 0 and InStr(fp_colNameDelim, Mid(fp_sQry,fp_iFieldStart,1)) = 0)
fp_iFieldStart = fp_iFieldStart - 1
Loop
fp_iFieldStart = fp_iFieldStart + 1
fp_sColName = Mid(fp_sQry, fp_iFieldStart, fp_iFieldEnd - fp_iFieldStart + 1)
If( "NOT" = UCase(fp_sColName)) then
fp_iFieldEnd = fp_iFieldStart - 1
Do While (fp_iFieldEnd) > 0 and (Mid(fp_sQry,fp_iFieldEnd,1) = " ")
fp_iFieldEnd = fp_iFieldEnd - 1
Loop
fp_colNameDelim = ""
If(fp_iFieldEnd) > 0 then
fp_sTemp = Mid(fp_sQry,fp_iFieldEnd,1)
If(InStr("])""",fp_sTemp)) then
If(InStr("]",fp_sTemp)) then
fp_colNameDelim = ".["
ElseIf (InStr(")",fp_sTemp)) then
fp_colNameDelim = ".("
ElseIf (InStr("""",fp_sTemp)) then
fp_colNameDelim = "."""
End If
I am having difficulty add or deleting any records from my database using database editor or submission. I can view them OK if I add records in myself directly into the database using MS Access. I have been to fpdbrgn1 may be suspect. is it true? here is my coding
<%
FP_SetLocaleForPage
' determine whether or not to provide navigation controls
if fp_iPageSize > 0 then
fp_fShowNavbar = True
else
fp_fShowNavbar = False
end if
fp_sPagePath = Request.ServerVariables("PATH_INFO")
fp_sEnvKey = fp_sPagePath & "#fpdbr_" & fp_iRegion
fp_sFormName = "fpdbr_" & CStr(fp_iRegion)
fp_sFormKey = fp_sFormName & "_PagingMove"
fp_sInputs = fp_sDefault
fp_DEBUG = True
fp_sFirstLabel = " |< "
fp_sPrevLabel = " < "
fp_sNextLabel = " > "
fp_sLastLabel = " >| "
fp_sDashLabel = " -- "
if not IsEmpty(Request(fp_sFormKey)) then
fp_sMoveType = Request(fp_sFormKey)
else
fp_sMoveType = ""
end if
fp_iCurrent=1
fp_fError=False
fp_bBlankField=False
Set fp_dictInputs = Server.CreateObject("Scripting.Dictionary")
Set fp_dictParams = Server.CreateObject("Scripting.Dictionary")
Set fp_dictColTypes = Server.CreateObject("Scripting.Dictionary")
fp_iParam = 1
fp_sQry = FP_ReplaceQuoteChars(fp_sQry)
' replace any input parameters in query string
' there need to be at least 5 more characters in the string for there to be input parameters (::[_a-z]::)
Do While (Not fp_fError) And (fp_iCurrent + 5 < Len(fp_sQry) And Instr(fp_iCurrent, fp_sQry, "::") > 0)
fp_iMax = Len(fp_sQry) + 1
fp_iColonStart = Instr(fp_iCurrent, fp_sQry, "::")
fp_iSQuoteStart = Instr(fp_iCurrent, fp_sQry, "'")
fp_iDQuoteStart = Instr(fp_iCurrent, fp_sQry, """")
If (fp_iSQuoteStart = 0) then
fp_iSQuoteStart = fp_iMax
End If
If (fp_iDQuoteStart = 0) then
fp_iDQuoteStart = fp_iMax
End If
fp_sQuoteDelim = ""
fp_iQuoteStart = -1
fp_iQuoteEnd = fp_iMax
fp_bQuoteFound = false
If (fp_iColonStart > fp_iSQuoteStart and fp_iDQuoteStart > fp_iSQuoteStart) then 'single quote is first sought for character
fp_sQuoteDelim = "'"
fp_iQuoteStart = fp_iSQuoteStart
elseIf (fp_iColonStart > fp_iDQuoteStart and fp_iSQuoteStart > fp_iDQuoteStart) then 'double quote is first sought for character
fp_sQuoteDelim = """"
fp_iQuoteStart = fp_iDQuoteStart
else
'The :: comes before any ' or "
End If
If(fp_sQuoteDelim <> "") then
fp_iPotQuoteEnd = fp_iQuoteStart + 1
Do While (fp_bQuoteFound = false and fp_iPotQuoteEnd < fp_iMax)
fp_iPotQuoteEnd = Instr(fp_iPotQuoteEnd, fp_sQry, fp_sQuoteDelim)
If(fp_iPotQuoteEnd = 0) then
exit do
End If
If(fp_iPotQuoteEnd = fp_iMax - 1) then
fp_iQuoteEnd = fp_iPotQuoteEnd
fp_bQuoteFound = true
exit do
End If
If(Mid(fp_sQry, fp_iPotQuoteEnd + 1, 1) <> fp_sQuoteDelim) then
fp_iQuoteEnd = fp_iPotQuoteEnd
fp_bQuoteFound = true
else
fp_iPotQuoteEnd = fp_iPotQuoteEnd + 2
End If
Loop
If(fp_bQuoteFound = false) then
Err.Description = "Unable to find a matching quote for " & fp_sQuoteDelim & " in the query."
fp_fError = true
fp_bSkip = true
End If
If(fp_iColonStart > fp_iQuoteEnd) then 'there is no user input in this literal string
fp_iCurrent = fp_iQuoteEnd + 1
fp_bSkip = true
End If
else
fp_iQuoteStart = fp_iColonStart
fp_bQuoteFound = false
End If
If not fp_bSkip then
fp_iStart = fp_iColonStart
' found a opening ::, find the close ::
fp_iEnd = InStr(fp_iStart + 2, fp_sQry, "::")
If not fp_bQuoteFound then
fp_iQuoteEnd = fp_iEnd + 1
End If
If fp_iEnd = 0 Then
fp_fError = True
Response.Write "<B>Database Results Error: mismatched parameter delimiters</B>"
Else
fp_sField = Mid(fp_sQry, fp_iStart + 2, fp_iEnd - fp_iStart - 2)
fp_sValue = Request.Form(fp_sField)
if len(fp_sValue) = 0 then fp_sValue = Request.QueryString(fp_sField)
' if the named form field doesn't exist, make a note of it
If (len(fp_sValue) = 0) Then
fp_iStartField = InStr(fp_sDefault, fp_sField & "=")
if fp_iStartField > 0 then
fp_iStartField = fp_iStartField + len(fp_sField) + 1
fp_iEndField = InStr(fp_iStartField,fp_sDefault,"&")
if fp_iEndField > 0 then
fp_sValue = Mid(fp_sDefault,fp_iStartField,fp_iEndField - fp_iStartField)
else
fp_sValue = Mid(fp_sDefault,fp_iStartField)
end if
end if
End If
' remember names and values used in query
if not fp_dictInputs.Exists(fp_sField) then
fp_dictInputs.Add fp_sField, fp_sValue
end if
if (len(fp_sValue) = 0) Then fp_bBlankField = True
fp_iOpEnd = fp_iQuoteStart - 1
Do While (Mid (fp_sQry , fp_iOpEnd , 1) = " ")
fp_iOpEnd = fp_iOpEnd - 1
Loop
fp_iFieldEnd = fp_iOpEnd
If ( Mid(fp_sQry, fp_iOpEnd - 1, 2) = "<=") then
fp_iFieldEnd = fp_iOpEnd - 2
ElseIf (Mid(fp_sQry, fp_iOpEnd - 1, 2) = ">=") then
fp_iFieldEnd = fp_iOpEnd - 2
ElseIf (Mid(fp_sQry, fp_iOpEnd - 1, 2) = "<>") then
fp_iFieldEnd = fp_iOpEnd - 2
ElseIf (UCase(Mid(fp_sQry, fp_iOpEnd - 3, 4)) = "LIKE" ) then
fp_iFieldEnd = fp_iOpEnd - 4
ElseIf (Mid(fp_sQry, fp_iOpEnd, 1) = "=") then
fp_iFieldEnd = fp_iOpEnd - 1
ElseIf (Mid(fp_sQry, fp_iOpEnd, 1) = "<") then
fp_iFieldEnd = fp_iOpEnd - 1
ElseIf (Mid(fp_sQry, fp_iOpEnd, 1) = ">") then
fp_iFieldEnd = fp_iOpEnd - 1
End If
If(fp_iFieldEnd <> fp_iOpEnd) Then
Do While (fp_iFieldEnd) > 0 and (Mid(fp_sQry,fp_iFieldEnd,1) = " ")
fp_iFieldEnd = fp_iFieldEnd - 1
Loop
fp_colNameDelim = ""
If(fp_iFieldEnd) > 0 then
fp_sTemp = Mid(fp_sQry,fp_iFieldEnd,1)
If(InStr("])""",fp_sTemp)) then
If(InStr("]",fp_sTemp)) then
fp_colNameDelim = ".["
ElseIf (InStr(")",fp_sTemp)) then
fp_colNameDelim = ".("
ElseIf (InStr("""",fp_sTemp)) then
fp_colNameDelim = "."""
End If
'In the End, we ignore the 'quote' character
fp_iFieldEnd = fp_iFieldEnd - 1
End If
End If
fp_iFieldStart = fp_iFieldEnd
If (fp_colNameDelim = "") then
fp_colNameDelim = " (."
End If
DO while (fp_iFieldStart > 0 and InStr(fp_colNameDelim, Mid(fp_sQry,fp_iFieldStart,1)) = 0)
fp_iFieldStart = fp_iFieldStart - 1
Loop
fp_iFieldStart = fp_iFieldStart + 1
fp_sColName = Mid(fp_sQry, fp_iFieldStart, fp_iFieldEnd - fp_iFieldStart + 1)
If( "NOT" = UCase(fp_sColName)) then
fp_iFieldEnd = fp_iFieldStart - 1
Do While (fp_iFieldEnd) > 0 and (Mid(fp_sQry,fp_iFieldEnd,1) = " ")
fp_iFieldEnd = fp_iFieldEnd - 1
Loop
fp_colNameDelim = ""
If(fp_iFieldEnd) > 0 then
fp_sTemp = Mid(fp_sQry,fp_iFieldEnd,1)
If(InStr("])""",fp_sTemp)) then
If(InStr("]",fp_sTemp)) then
fp_colNameDelim = ".["
ElseIf (InStr(")",fp_sTemp)) then
fp_colNameDelim = ".("
ElseIf (InStr("""",fp_sTemp)) then
fp_colNameDelim = "."""
End If