Access Database record added via asp - but it is not inserted

T

Trevor

I have developed an application using frontpage and MS Access, all functions
work correctly on my development system. Have published the web site to a
production server and all seemed to work.

However when functions add a record the a database table, asp reports that
the record was added, but in fact it doesn't get into the database. Read and
update functions work correctly. The new site is on a windows 2003 server
using frontpage with server extensions 2002 and MS Office 2003 including
Access.

I have tried to do an odbc trace, but couldn't get that to work either.

Does anyone have suggestions how to determine what could be wrong?

Copy of asp source:

<%

On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1252
Session.LCID = 2057
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("CopyScheduling_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"

fp_rs.Open """Client Table""", 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(2)
Dim arFormDBFields0(2)
Dim arFormValues0(2)

arFormFields0(0) = "Field2"
arFormDBFields0(0) = "Client Name"
arFormValues0(0) = Request("Field2")
arFormFields0(1) = "Field3"
arFormDBFields0(1) = "Current"
arFormValues0(1) = "Yes"

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:",_
"Add_Client_page.asp",_
"Return to the form."

End If
End If

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

%>
<% Response.Buffer = True %>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Add a Client </title>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>

<body bgcolor="#FFFFFF" background="images/Background.bmp">

<table width="100%" align=left>
<tr>
<td width="100%">
<p align="center"><font size="+3"><b>Add A Client</b></font>
</td>
</tr>
</table>


<p>
<br clear="all">
<hr>
<p>

<form METHOD="POST" action="--WEBBOT-SELF--">

<input TYPE="hidden" NAME="VTI-GROUP" VALUE="0">
<!--#include file="_fpclass/fpdbform.inc"-->

<p><b>Client Name</b><br>
<input type="TEXT" name="Field2" size="50" value="" maxlength="50"><br>
</p>


<p><input type="submit" value=" OK "><input type="reset" value=" Reset
"></p>

</form>

</body>

</html>
 
T

Trevor

Resolved.

The problem was due to different double quotes vs square brackets.
Removing the on error resume highlighted the problem.
Resolution is to change

fp_rs.Open """Client Table"""", fp_conn, 1, 3, 2 ' adOpenKeySet,
adLockOptimistic, adCmdTable

to

fp_rs.Open "[Client Table]", fp_conn, 1, 3, 2 ' adOpenKeySet,
adLockOptimistic, adCmdTable
 

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