Update database from Frontpage Form

G

Guest

I'm trying to create a form that will allow users to update our SQL Server
database with some basic information.

I have a very simple SQL Server database setup with only one table so far.
I have created a new website with a page that includes a form that is
connected to the database. I created this form by using the insert --> form
option in Frontpage 2003.

When I try to test the form by entering a value into the form and clicking
submit, I see the confirmation page, but when I check the table nothing has
been added. The database and the website are on the same server. I
currently don't have any username or password info setup for my database
connection because when I do that my connection fails.

I'm not sure which step I've messed up. Any help is GREATLY appreciated.
Thank you!
 
D

David Berry

Does the page have a .asp extension? Can you paste the code for the page
into a reply so we can see what's happening?
 
G

Guest

It does have an ASP extension. The code is below.

' 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
Session.LCID = 1033
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("NewAccts_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"

fp_rs.Open "NewAcct", 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) = "T1"
arFormDBFields0(0) = "ClientCode"
arFormValues0(0) = Request("T1")

FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0


fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"

fp_rs.Close
fp_conn.Close

FP_FormConfirmation "text/html; charset=windows-1252",_
"Form Confirmation",_
"Thank you for submitting the following information:",_
"NewAcct.asp",_
"Return to the form."

End If
End If

Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")

%>
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>NewAcct</title>
</head>

<body>

<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveDatabase" SuggestedExt="asp"
S-DataConnection="NewAccts" S-RecordSource="NewAcct" S-Form-Fields="T1"
S-Form-DBFields="ClientCode" 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>Cli Code: <input type="text" name="T1" size="20"></p>
<p> </p>
<p><input type="submit" value="Submit" name="B1"><input type="reset"
value="Reset" name="B2"></p>
</form>

</body>

</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top