|
destiple -> RE: Web Form Won't Update Access DB (8/23/2005 11:49:40)
|
Here it is. quote:
<% ' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit. On Error Resume Next Session("FP_OldCodePage") = Session.CodePage Session("FP_OldLCID") = Session.LCID Session.CodePage = 1252 Err.Clear strErrorUrl = "" If Request.ServerVariables("REQUEST_METHOD") = "POST" Then If Request.Form("VTI-GROUP") = "0" Then Err.Clear Set fp_conn = Server.CreateObject("ADODB.Connection") FP_DumpError strErrorUrl, "Cannot create connection" Set fp_rs = Server.CreateObject("ADODB.Recordset") FP_DumpError strErrorUrl, "Cannot create record set" fp_conn.Open Application("guestbook_ConnectionString") FP_DumpError strErrorUrl, "Cannot open database" fp_rs.Open "BillCom", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable FP_DumpError strErrorUrl, "Cannot open record set" fp_rs.AddNew FP_DumpError strErrorUrl, "Cannot add new record set to the database" Dim arFormFields0(1) Dim arFormDBFields0(1) Dim arFormValues0(1) arFormFields0(0) = "comments" arFormDBFields0(0) = "Comments" arFormValues0(0) = Request("comments") FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0 If Request.ServerVariables("HTTP_USER_AGENT") <> "" Then FP_SaveFieldToDB fp_rs, Request.ServerVariables("HTTP_USER_AGENT"), "Browser_type" End If If Request.ServerVariables("REMOTE_HOST") <> "" Then FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_HOST"), "IPAddress" End If FP_SaveFieldToDB fp_rs, Now, "Date" If Request.ServerVariables("REMOTE_USER") <> "" Then FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_USER"), "User_name" End If fp_rs.Update FP_DumpError strErrorUrl, "Cannot update the database" fp_rs.Close fp_conn.Close Session("FP_SavedFields")=arFormFields0 Session("FP_SavedValues")=arFormValues0 Session.CodePage = Session("FP_OldCodePage") Session.LCID = Session("FP_OldLCID") Response.Redirect "bill.asp" End If End If Session.CodePage = Session("FP_OldCodePage") Session.LCID = Session("FP_OldLCID") %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> </head> <body link="#94594C" vlink="#94594C" alink="#FEBA00" text="#94594C" bgcolor="#FFFFFF" style="font-family: Arial Narrow; font-size: 12pt"> <div align="center"> <table border="0" cellpadding="5" cellspacing="5" width="632" height="547"> <!-- MSTableType="layout" --> <tr> <td colspan="2" height="75" align="center"> <!-- MSCellType="ContentHead" --> <div align="left"> <!--webbot CLIENTSIDE bot="Ws3FpEx" MODULEID="'lnf (project)\logo.xws'" PREVIEW="<img src='images/logo.gif?006EEB98' editor='Webstyle3' border='0'>" startspan --> <img src="images/logo.gif?006EEB98" editor="Webstyle3" border="0"> <!--webbot bot="Ws3FpEx" endspan i-checksum="43076" --> </div> </td> </tr> <tr> <td valign="top" rowspan="2" width="109"> <!-- MSCellType="NavBody" --> <div align="right"> <!--webbot CLIENTSIDE bot="Ws3FpEx" MODULEID="'lnf (project)\lnf_off.xws'" PREVIEW="<img src='images/lnf.gif?00701F9E' editor='Webstyle3' border='0'>" startspan --> <script src="xaramenu.js"></script><script webstyle3 src="images/lnf.js"></script><noscript><img src="images/lnf.gif?00701F9E" editor="Webstyle3"></noscript> <!--webbot bot="Ws3FpEx" endspan i-checksum="8988" --> </div> </td> <td valign="top" height="49"> <!-- MSCellType="ContentHead2" --> </td> </tr> <tr> <td valign="top" height="423" width="523"> <!-- MSCellType="ContentBody" --> <p> <!--webbot CLIENTSIDE bot="Ws3FpEx" MODULEID="'LnF (Project)\the_thrill.xws'" PREVIEW="<img src='images/the_thrill.gif?05695088' editor='Webstyle3' border='0'>" startspan --><img src="images/the_thrill.gif?05695088" editor="Webstyle3" border="0"> <!--webbot bot="Ws3FpEx" endspan i-checksum="16604" --></p> <p><img border="0" src="images/bandfiles/bill.jpg" align="left">bill is a master of the strat-o-caster (that rhymed). He loves his two-pack of abs and hangs out at the animal shelter every sunday hoping to figure out what they really mean by "puppy love".</p> <p> </p> <p> </p> <p> </p> <p> </p> <p>Comments</p> <form method="POST" action="--WEBBOT-SELF--"> <!--webbot bot="SaveDatabase" suggestedext="asp" s-dataconnection="guestbook" s-recordsource="BillCom" u-database-url="fpdb/guestbook.mdb" u-confirmation-url="bill.asp" s-builtin-fields="HTTP_USER_AGENT REMOTE_HOST Timestamp REMOTE_USER" s-builtin-dbfields="Browser_type IPAddress Date User_name" s-form-fields="comments" s-form-dbfields="Comments" U-ASP-Include-Url="_fpclass/fpdbform.inc" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include file="_fpclass/fpdbform.inc"--><!--webbot bot="SaveDatabase" i-checksum="40548" endspan --><p> <textarea rows="5" name="comments" cols="45"></textarea></p> <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p> </form> <!--webbot bot="DatabaseRegionStart" s-columnnames="ID,Date,Comments,IPAddress" s-columntypes="3,135,203,202" s-dataconnection="guestbook" b-tableformat="FALSE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="FALSE" b-listseparator="TRUE" i-listformat="0" b-makeform="TRUE" s-recordsource="BillComQuery" s-displaycolumns="Date,Comments" s-criteria s-order s-sql="SELECT * FROM BillComQuery" 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="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00"><font color="#000000">This is the start of a Database Results region. The page must be fetched from a web server with a web browser to display correctly; the current web is stored on your local disk or network.</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 BillComQuery" fp_sDefault="" fp_sNoRecords="No records returned." fp_sDataConn="guestbook" fp_iMaxRecords=256 fp_iCommandType=1 fp_iPageSize=0 fp_fTableFormat=False fp_fMenuFormat=False fp_sMenuChoice="" fp_sMenuValue="" fp_sColTypes="&ID=3&Date=135&Comments=203&IPAddress=202&" fp_iDisplayCols=2 fp_fCustomQuery=False BOTID=0 fp_iRegion=BOTID %> <!--#include file="_fpclass/fpdbrgn1.inc"--> <!--webbot bot="DatabaseRegionStart" endspan i-checksum="46260" --><p> <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,Date,Comments,IPAddress" s-column="Date" b-tableformat="FALSE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>Date<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"Date")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="3267" --></p> <p> <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,Date,Comments,IPAddress" s-column="Comments" b-tableformat="FALSE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>Comments<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"Comments")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="16369" --><br> <hr></p> <!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="FALSE" u-dbrgn2="_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00"><font color="#000000">This is the end of a Database Results region.</font></td></tr></table>" startspan --><!--#include file="_fpclass/fpdbrgn2.inc"--> <!--webbot bot="DatabaseRegionEnd" endspan i-checksum="62730" --><p> </td> </tr> </table> </div> <!-- Start of StatCounter Code --> <script type="text/javascript" language="javascript"> var sc_project=523698; var sc_partition=3; </script> <script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script> <!-- End of StatCounter Code --> </body> </html>
|
|
|
|