S
SS
Hi
I have now discovered that the following code sends a mail as soon as it is
executed which would explain why no information is in the mail. Once the
form is filled in and the submit button hit the result is the same only the
field names Name and Department appear in the mail the same as the first
mail. I'm starting think that CDO and Frontpage forms to a database are not
possible but would be great if anyone can tell me differently!
<%
' 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("name_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"
fp_rs.Open "Results", 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) = "Department"
arFormDBFields0(0) = "Department"
arFormValues0(0) = Request("Department")
arFormFields0(1) = "Name"
arFormDBFields0(1) = "Name"
arFormValues0(1) = Request("Name")
FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0
FP_SaveFieldToDB fp_rs, Now, "Timestamp"
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:",_
"cdoscript.asp",_
"Return to the form."
End If
End If
Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")
%>
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Software Requirements Form</title>
</head>
<body>
<!--
METADATA
TYPE="typelib"
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library"
-->
<%
Dim TextBody
Dim Name
Dim Department
Set cdoConfig = CreateObject("CDO.Configuration")
TextBody = TextBody & "Name " & Request("Name").Item & VbCrLf
TextBody = TextBody & "Department " & Request("Department").Item & VbCrLf
With cdoConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "my.server.com"
.Update
End With
Dim objMail
'Create the mail object
Set objMail = Server.CreateObject("CDO.Message")
'Set key properties
objMail.From = "(e-mail address removed)"
objMail.To = "(e-mail address removed)"
objMail.Subject = "Software Required"
objMail.TextBody = TextBody
objMail.Send
Set cdoMessage = Nothing
Set cdoConfig = Nothing
%>
<p align="center"><b><font size="6" face="Arial">Software Requirements
Form</font></b><p> </p>
<p> </p>
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveDatabase" SuggestedExt="asp" S-DataConnection="name"
S-RecordSource="Results" U-Database-URL="../fpdb/name.mdb"
S-Form-Fields="Department Name" S-Form-DBFields="Department Name"
S-Builtin-Fields="Timestamp" S-Builtin-DBFields="Timestamp" startspan
U-ASP-Include-Url="../_fpclass/fpdbform.inc" --><input TYPE="hidden"
NAME="VTI-GROUP" VALUE="0"><!--#include
file="../_fpclass/fpdbform.inc"--><!--webbot bot="SaveDatabase" endspan
i-checksum="34604" -->
<table CELLSPACING="0" CELLPADDING="0" BORDER="0" WIDTH="530" id="table1">
<tr>
<td WIDTH="180" valign="top"><font face="Arial">Name</font></td>
<td WIDTH="350" colspan="3">
<input type="text" name="Name" size="20"></td>
</tr>
<tr>
<td WIDTH="180" valign="top"> </td>
<td WIDTH="80"> </td>
<td WIDTH="10"> </td>
<td WIDTH="80"> </td>
</tr>
<tr>
<td WIDTH="180" valign="top">Department</td>
<td WIDTH="350" colspan="3">
<input type="text" name="Department" size="20"></td>
</tr>
</table>
<p> &
nbsp;  
; &nb
sp; <input type="submit" value="Submit"
name="B1"></p>
</form>
</body>
</html>
I have now discovered that the following code sends a mail as soon as it is
executed which would explain why no information is in the mail. Once the
form is filled in and the submit button hit the result is the same only the
field names Name and Department appear in the mail the same as the first
mail. I'm starting think that CDO and Frontpage forms to a database are not
possible but would be great if anyone can tell me differently!
<%
' 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("name_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"
fp_rs.Open "Results", 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) = "Department"
arFormDBFields0(0) = "Department"
arFormValues0(0) = Request("Department")
arFormFields0(1) = "Name"
arFormDBFields0(1) = "Name"
arFormValues0(1) = Request("Name")
FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0
FP_SaveFieldToDB fp_rs, Now, "Timestamp"
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:",_
"cdoscript.asp",_
"Return to the form."
End If
End If
Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")
%>
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Software Requirements Form</title>
</head>
<body>
<!--
METADATA
TYPE="typelib"
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library"
-->
<%
Dim TextBody
Dim Name
Dim Department
Set cdoConfig = CreateObject("CDO.Configuration")
TextBody = TextBody & "Name " & Request("Name").Item & VbCrLf
TextBody = TextBody & "Department " & Request("Department").Item & VbCrLf
With cdoConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "my.server.com"
.Update
End With
Dim objMail
'Create the mail object
Set objMail = Server.CreateObject("CDO.Message")
'Set key properties
objMail.From = "(e-mail address removed)"
objMail.To = "(e-mail address removed)"
objMail.Subject = "Software Required"
objMail.TextBody = TextBody
objMail.Send
Set cdoMessage = Nothing
Set cdoConfig = Nothing
%>
<p align="center"><b><font size="6" face="Arial">Software Requirements
Form</font></b><p> </p>
<p> </p>
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveDatabase" SuggestedExt="asp" S-DataConnection="name"
S-RecordSource="Results" U-Database-URL="../fpdb/name.mdb"
S-Form-Fields="Department Name" S-Form-DBFields="Department Name"
S-Builtin-Fields="Timestamp" S-Builtin-DBFields="Timestamp" startspan
U-ASP-Include-Url="../_fpclass/fpdbform.inc" --><input TYPE="hidden"
NAME="VTI-GROUP" VALUE="0"><!--#include
file="../_fpclass/fpdbform.inc"--><!--webbot bot="SaveDatabase" endspan
i-checksum="34604" -->
<table CELLSPACING="0" CELLPADDING="0" BORDER="0" WIDTH="530" id="table1">
<tr>
<td WIDTH="180" valign="top"><font face="Arial">Name</font></td>
<td WIDTH="350" colspan="3">
<input type="text" name="Name" size="20"></td>
</tr>
<tr>
<td WIDTH="180" valign="top"> </td>
<td WIDTH="80"> </td>
<td WIDTH="10"> </td>
<td WIDTH="80"> </td>
</tr>
<tr>
<td WIDTH="180" valign="top">Department</td>
<td WIDTH="350" colspan="3">
<input type="text" name="Department" size="20"></td>
</tr>
</table>
<p> &
nbsp;  
; &nb
sp; <input type="submit" value="Submit"
name="B1"></p>
</form>
</body>
</html>