|
rrnml -> RE: ODBC error (6/10/2005 17:29:35)
|
Here's the code. I'm sure that will help.
<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.
On Error Resume Next
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("Publ_Inq_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"
fp_rs.Open "Inquiry", 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) = "scaddr"
arFormDBFields0(0) = "Inquirer_address"
arFormValues0(0) = Request("scaddr")
arFormFields0(0) = "scinqname"
arFormDBFields0(0) = "Inquirer_name"
arFormValues0(0) = Request("scinqname")
arFormFields0(0) = "screspother"
arFormDBFields0(0) = "Response_other"
arFormValues0(0) = Request("screspother")
arFormFields0(0) = "scemail"
arFormDBFields0(0) = "Inquirer_email"
arFormValues0(0) = Request("scemail")
arFormFields0(0) = "scphone"
arFormDBFields0(0) = "Inquirer_phone"
arFormValues0(0) = Request("scphone")
arFormFields0(0) = "scresponse"
arFormDBFields0(0) = "Response"
arFormValues0(0) = Request("scresponse")
arFormFields0(0) = "sctopic"
arFormDBFields0(0) = "Topic"
arFormValues0(0) = Request("sctopic")
arFormFields0(0) = "sczip"
arFormDBFields0(0) = "Inquirer_zip"
arFormValues0(0) = Request("scinqname")
arFormFields0(0) = "scformat"
arFormDBFields0(0) = "Format"
arFormValues0(0) = Request("scformat")
arFormFields0(0) = "sctopother"
arFormDBFields0(0) = "Topic_other"
arFormValues0(0) = Request("sctopother")
arFormFields0(0) = "scdiv"
arFormDBFields0(0) = "Division"
arFormValues0(0) = Request("scdiv")
arFormFields0(0) = "scstate"
arFormDBFields0(0) = "Inquirer_state"
arFormValues0(0) = Request("scstate")
arFormFields0(0) = "sccity"
arFormDBFields0(0) = "inquirer_city"
arFormValues0(0) = Request("sccity")
arFormFields0(0) = "sccatgry"
arFormDBFields0(0) = "Category"
arFormValues0(0) = Request("sccatgry")
arFormFields0(0) = "scname"
arFormDBFields0(0) = "Name"
arFormValues0(0) = Request("scname")
arFormFields0(0) = "scdate"
arFormDBFields0(0) = "Date"
arFormValues0(0) = Request("scdate")
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:",_
"PublicInquiriesForm.asp",_
"Return to the form."
End If
End If
%>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<head>
<title>Public Iquiry Query</title>
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:Approval_x0020_Level msdt:dt="string"></mso:Approval_x0020_Level>
<mso:Categories msdt:dt="string">Business</mso:Categories>
<mso:Assigned_x0020_To msdt:dt="string"></mso:Assigned_x0020_To>
</mso:CustomDocumentProperties>
</xml><![endif]-->
<meta name="Microsoft Border" content="b, default">
</head>
<%
Dim con
Dim rst
Dim strSQL
Dim strParm1
Dim strParm2
Const adOpenKeyset = 0
Const adLockOptimistic = 1
'Create the objects
Set con = Server.CreateObject("ADODB.Connection")
Set rst = Server.CreateObject("ADODB.Recordset")
' Open the connection to the Employee In or Out Database
con.Open "PubInq", "sqlquery", "querysql"
' Create the SQL Query String
' Employee Query String
strSQL = " select Name, Division, Inquirer_Category, Inquiry_Format, Topic, Response " & _
" from Employees, Division, Inquirer_Category, Inquiry_Format, Topic, Response " & _
" Order by Name "
Set rst = Server.CreateObject("ADODB.Recordset")
rst.Open strSQL, con, adOpenKeyset, adLockOptimistic
%>
<p align="center"><strong><font size="5">Public Inquiries Entry Form</font></strong></p>
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveDatabase" suggestedext="asp" u-asp-include-url="http://internal/Queries/_fpclass/fpdbform.inc" s-dataconnection="Pub_Inq" s-recordsource="Inquiry" s-form-fields="scaddr scinqname screspother scemail scphone scresponse sctopic sczip scformat sctopother scdiv scstate sccity sccatgry scname scdate" s-form-dbfields="Inquirer_address Inquirer_name Response_other Inquirer_email Inquirer_phone Response Topic Inquirer_zip Format Topic_other Division Inquirer_state inquirer_city Category Name Date" --><p align="left">
<u><b>Date Received</b> </u><p align="left">
<input type="text" name="scdate" size="20"> (YYYYMMDD)<p align="left">
<u><b>Staff name & Division Receiving Inquiry</b></u></p>
<p align="left">
<select size="1" name="scname">
<%
' Only display records if there are records in the recordset
If NOT rst.EOF then
'Loop through the recordset until ther are no more records
Do While Not rst.EOF
%> <option value="<%=rst("Name")%>"><%=rst("Name")%></option>
<%
'If you forget this next statement, you will be stuck in a loop
rst.MoveNext
Loop
Else
%> <option value="Error">No records Found</option>
<%
End If
rst.Close
%>
</select> <b>Name</b>
<select size="1" name="scdiv">
<%
' Only display records if there are records in the recordset
If NOT rst.EOF then
'Loop through the recordset until ther are no more records
Do While Not rst.EOF
%> <option value="<%=rst("Division")%>"><%=rst("Division")%></option>
<%
'If you forget this next statement, you will be stuck in a loop
rst.MoveNext
Loop
Else
%> <option value="Error">No records Found</option>
<%
End If
rst.Close
%>
</select> <b>Division</b> </p>
<p align="left">
<b><u>Inquirer Category</u>
<u>Inquiry Format</u></b></p>
<p align="left">
<select size="1" name="sccatgry">
<%
' Only display records if there are records in the recordset
If NOT rst.EOF then
'Loop through the recordset until ther are no more records
Do While Not rst.EOF
%> <option value="<%=rst("Inquirer_Category")%>"><%=rst("Inquirer_Category")%></option>
<%
'If you forget this next statement, you will be stuck in a loop
rst.MoveNext
Loop
Else
%> <option value="Error">No records Found</option>
<%
End If
rst.Close
%>
</select> <select size="1" name="scformat">
<%
' Only display records if there are records in the recordset
If NOT rst.EOF then
'Loop through the recordset until ther are no more records
Do While Not rst.EOF
%> <option value="<%=rst("Inquiry_Format")%>"><%=rst("Inquiry_Format")%></option>
<%
'If you forget this next statement, you will be stuck in a loop
rst.MoveNext
Loop
Else
%> <option value="Error">No records Found</option>
<%
End If
rst.Close
%>
</select><b> </b></p>
<p align="left">
<u><b>Name of Inquirer</b></u></p>
<p align="left">
<input type="text" name="scinqname" size="20"></p>
<p align="left">
<u>
<b>Inquirer Contact Information</b></u></p>
<p align="left"><input type="text" name="scphone" size="20">
<b>Telephone Number </b> </p>
<p align="left"><input type="text" name="scaddr" size="20">
<b> Mailing Address </b></p>
<p align="left"><input type="text" name="sccity" size="20">
<b>City</b></p>
<p align="left"><input type="text" name="scstate" size="20">
<b>State</b></p>
<p align="left"><input type="text" name="sczip" size="20">
<b> Zip</b></p>
<p align="left"><input type="text" name="scemail" size="20">
<b> Email Address</b></p>
<p align="left">
<b><u>Description/Topic of Inquiry</u>
<u>Description of Response or Referral</u></b></p>
<p align="left">
<select size="1" name="sctopic">
<%
' Only display records if there are records in the recordset
If NOT rst.EOF then
'Loop through the recordset until ther are no more records
Do While Not rst.EOF
%> <option value="<%=rst("Topic")%>"><%=rst("Topic")%></option>
<%
'If you forget this next statement, you will be stuck in a loop
rst.MoveNext
Loop
Else
%> <option value="Error">No records Found</option>
<%
End If
rst.Close
%>
</select>
<select size="1" name="scresponse">
<%
' Only display records if there are records in the recordset
If NOT rst.EOF then
'Loop through the recordset until ther are no more records
Do While Not rst.EOF
%> <option value="<%=rst("Response")%>"><%=rst("Response")%></option>
<%
'If you forget this next statement, you will be stuck in a loop
rst.MoveNext
Loop
Else
%> <option value="Error">No records Found</option>
<%
End If
rst.Close
%>
</select></p>
<p align="left">
<input type="text" name="sctopother" size="20"> <b>Other</b>
<input type="text" name="screspother" size="20"> <b>Other </b> </p>
<p align="left">
<input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
<p align="left">
</p>
</form>
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" u-file="_private/form_results.csv" s-format="TEXT/CSV" s-label-fields="TRUE" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="1"><!--webbot bot="SaveResults" endspan i-checksum="43406" --><p align="left">
</p>
</form>
</td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html><!--webbot bot="SaveDatabase" endspan i-checksum="27767" -->
|
|
|
|