Database Update Problem (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


steveg -> Database Update Problem (6/25/2008 5:30:14)

I have done this a few times before but I guess I must be missing something this time!!

I am getting a database update error message:

Database Results Error
The operation failed. If this continues, please contact your server administrator.

Here is the code for the update form (where I do my editing)
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit.
FP_CharSet = "windows-1252"
FP_CodePage = 1252 %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<!--webbot bot="DatabaseRegionStart" s-columnnames="ID,ItemPosition,ItemDate,ItemTitle,ItemContent,ItemActive,Remote_computer_name,User_name,Browser_type,Timestamp" s-columntypes="3,202,202,202,203,202,202,202,202,135" s-dataconnection="walker" b-tableformat="FALSE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="7" b-makeform="TRUE" s-recordsource="Results" s-displaycolumns="ID,ItemPosition,ItemDate,ItemTitle,ItemContent,ItemActive" s-criteria s-order s-sql="SELECT * FROM Results" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records returned." i-maxrecords="256" i-groupsize="1" botid="0" u-dblib="../../_fpclass/fpdblib.inc" u-dbrgn1="../../_fpclass/fpdbrgn1.inc" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00" align="left"><font color="#000000">This is the start of a Database Results region.</font></td></tr></table>" startspan --><!--#include file="../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Results"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="walker"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=1
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&ID=3&ItemPosition=202&ItemDate=202&ItemTitle=202&ItemContent=203&ItemActive=202&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp=135&"
fp_iDisplayCols=6
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="16271" --><form METHOD="POST" action="update.asp">
  <p>
  <!--webbot bot="PurpleText" preview="Set this form's properties so it submits user input to the appropriate page." --></p>
  <table BORDER="0">
    <tr>
      <td><b>ID:</b></td>
      <td>
      <input TYPE="TEXT" NAME="ID" SIZE="40" VALUE="<%=FP_FieldHTML(fp_rs,"ID")%>"></td>
    </tr>
    <tr>
      <td><b>ItemPosition:</b></td>
      <td>
      <input TYPE="TEXT" NAME="ItemPosition" SIZE="40" VALUE="<%=FP_FieldHTML(fp_rs,"ItemPosition")%>"></td>
    </tr>
    <tr>
      <td><b>ItemDate:</b></td>
      <td>
      <input TYPE="TEXT" NAME="ItemDate" SIZE="40" VALUE="<%=FP_FieldHTML(fp_rs,"ItemDate")%>"></td>
    </tr>
    <tr>
      <td><b>ItemTitle:</b></td>
      <td>
      <input TYPE="TEXT" NAME="ItemTitle" SIZE="40" VALUE="<%=FP_FieldHTML(fp_rs,"ItemTitle")%>"></td>
    </tr>
    <tr>
      <td><b>ItemContent:</b></td>
      <td>
      <input TYPE="TEXT" NAME="ItemContent" SIZE="40" VALUE="<%=FP_FieldHTML(fp_rs,"ItemContent")%>"></td>
    </tr>
    <tr>
      <td><b>ItemActive:</b></td>
      <td>
      <input TYPE="TEXT" NAME="ItemActive" SIZE="40" VALUE="<%=FP_FieldHTML(fp_rs,"ItemActive")%>"></td>
    </tr>
    <tr>
      <td COLSPAN="2"><br>
      <input TYPE="submit" NAME="fp_submit" value="Update"><input TYPE="Reset" NAME="fp_reset"></td>
    </tr>
  </table>
</form>
<hr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="FALSE" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" i-groupsize="1" clientside tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00" align="left"><font color="#000000">This is the end of a Database Results region.</font></td></tr><TR><TD ALIGN=LEFT VALIGN=MIDDLE><NOBR><INPUT TYPE=Button VALUE="  |<  "><INPUT TYPE=Button VALUE="   <  "><INPUT TYPE=Button VALUE="  >   "><INPUT TYPE=Button VALUE="  >|  ">  [1/1]</NOBR><BR></td></tr></table>" startspan --><!--#include file="../../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="65064" --></body></html>


Here is the code for the update file (to post the data to the database)
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit.
FP_CharSet = "windows-1252"
FP_CodePage = 1252 %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<table width="100%" border="1">
  <thead>
  </thead>
  <tbody>
    <!--webbot bot="DatabaseRegionStart" s-columnnames s-columntypes s-dataconnection="walker" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="TRUE" s-recordsource s-displaycolumns s-criteria s-order s-sql="UPDATE RESULTS<br>SET ItemTitle='%%ItemTitle%%',<br>ItemContent='%%ItemContent%%',<br>ItemDate='%%ItemDate%%',<br>ItemActive='%%ItemActive%%',<br>ItemPosition='%%ItemPosition%%'<br>WHERE ID='%%ID%%'<br>" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records returned." i-maxrecords="256" i-groupsize="0" botid="0" u-dblib="../../_fpclass/fpdblib.inc" u-dbrgn1="../../_fpclass/fpdbrgn1.inc" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" align="left" width="100%"><font color="#000000">This is the start of a Database Results region.</font></td></tr>" startspan --><!--#include file="../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="UPDATE RESULTS SET ItemTitle='%%ItemTitle%%', ItemContent='%%ItemContent%%', ItemDate='%%ItemDate%%', ItemActive='%%ItemActive%%', ItemPosition='%%ItemPosition%%' WHERE ID='%%ID%%' "
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=16 align=left width=""100%"">No records returned.</td></tr>"
fp_sDataConn="walker"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&"
fp_iDisplayCols=16
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="54952" --><!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" align="left" width="100%"><font color="#000000">This is the end of a Database Results region.</font></td></tr>" startspan --><!--#include file="../../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="65064" --></tbody>
</table>

</body>

</html>


I asume that it is something really stupid but I am just not seeing it.

Steve





pd_it_guy -> RE: Database Update Problem (6/25/2008 9:56:05)

A very look shows:

'%%value%%' when expected would be '::value::'

Is this FP generated or user generated.

Perhaps others may see something else. The % is part of the <% demarc for code, perhaps you can also use it in a variable but I have not seen it.





steveg -> RE: Database Update Problem (6/25/2008 10:16:02)

I probably should have changed that. I originally had the ::????:: and then in desperation Microsoft Support article Q240090 showed %%???%%. In desperation I tried it but have now changed back to ::???::

It would appear that all elements work well until the updating of the database. Then I get the message in the yellow box. Is there any way to be able to get something more informative than the yellow error message box?

Steve




pd_it_guy -> RE: Database Update Problem (6/25/2008 10:35:12)

See what happens when you get rid of all the gray code EXCEPT for the 3 critical include files and their encasing verbiage within the <!.....> brackets. Should not see any 'do not edits' and 'bots' if it is pure essentialized code which for an update page makes sense. There may be something in the gray area that is causing problems.

<!........fpdblib> (at the start, BEFORE the query block)
<!........fpdbrgn1> (after the query block)
<!........fpdbrgn2> (at the end, can be the very next line down)

That should make things MUCH easier to see.





pd_it_guy -> RE: Database Update Problem (6/25/2008 13:28:16)

OOPS I just thought of something else.

The variable 'ID' I presume, is a sequential record number, is it not, and thus, a numeric variable.

Try recovering thus: ::ID:: not '::ID::' Doing it with a quote will cause trouble. At least it caused me many wasted hours running down the problem. Can't give you a better explanation except it just seems to work that way. And I would have to guess that any other specifically declared numeric doesn't like the single quotes when you pull them out to write to the DB.

Good Luck. Hope we provided some ideas.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125