AllenRitch
Technical User
I'm trying to update two distinct tables in the same database using two seperate record sets. While the 1st record set (RDSet) is updated, the 2nd one (RDSet2) isn't. Below is the code I'm using along with the ASP error I recieve. Line 55 in the error message is the very 1st RDSet.Close statement. Thanks!
----------------------------- Code --------------------------------
<% LANGUAGE="VBSCRIPT" %>
<!--#include file=includes\DataConn.inc -->
<!--#include file=includes\UserClass.inc -->
<%
' Declare User Variable
Dim UserAlias
' Open UserClass
Dim User
Set User = New UserClass
' Get User's Alias
UserAlias = User.Alias
' Declare Form Variables
Dim asp_qust1, asp_qust2, asp_qust3, asp_qust4, asp_qust5, asp_qust6, asp_qust7, asp_qust8, asp_qust9, asp_qust10
Dim asp_qust11, asp_qust12, asp_qust13, asp_qust14, asp_qust15, asp_qust16, asp_qust17, asp_qust18, asp_commnts
' Assign Values
asp_qust1 = request.form("frm_qust_1"
asp_qust2 = request.form("frm_qust_2"
asp_qust3 = request.form("frm_qust_3"
asp_qust4 = request.form("frm_qust_4"
asp_qust5 = request.form("frm_qust_5"
asp_qust6 = request.form("frm_qust_6"
asp_qust7 = request.form("frm_qust_7"
asp_qust8 = request.form("frm_qust_8"
asp_qust9 = request.form("frm_qust_9"
asp_qust10 = request.form("frm_qust_10"
asp_qust11 = request.form("frm_qust_11"
asp_qust12 = request.form("frm_qust_12"
asp_qust13 = request.form("frm_qust_13"
asp_qust14 = request.form("frm_qust_14"
asp_qust15 = request.form("frm_qust_15"
asp_qust16 = request.form("frm_qust_16"
asp_qust17 = request.form("frm_qust_17"
asp_qust18 = request.form("frm_qust_18"
asp_commnts = replace(request.form("frm_commnts"
,"'","''"
' SQL Update Statement for tblFPA_Survey
SQLString = "INSERT INTO tblFPA_Survey (db_qust1, db_qust2, db_qust3, db_qust4, db_qust5, db_qust6, db_qust7, "
SQLString = SQLString + "db_qust8, db_qust9, db_qust10, db_qust11, db_qust12, db_qust13, db_qust14, db_qust15, db_qust16, "
SQLString = SQLString + "db_qust17, db_qust18, db_commnts) VALUES ('" & asp_qust1 & "', '" & asp_qust2 & "', '" & asp_qust3 & "', "
SQLString = SQLString + "'" & asp_qust4 & "', '" & asp_qust5 & "', '" & asp_qust6 & "', '" & asp_qust7 & "', '" & asp_qust8 & "', "
SQLString = SQLString + "'" & asp_qust9 & "', '" & asp_qust10 & "', '" & asp_qust11 & "', '" & asp_qust12 & "', '" & asp_qust13 & "', "
SQLString = SQLString + "'" & asp_qust14 & "', '" & asp_qust15 & "', '" & asp_qust16 & "', '" & asp_qust17 & "', '" & asp_qust18 & "', "
SQLString = SQLString + "'" & asp_commnts & "')"
' Create & Execute Record Set Update for tblFPA_Survey
Set RDSet=server.createobject("adodb.recordset"
Set RDSet = DBConn.execute(SQLString)
' Close First Record Set
RDSet.Close
Set RDSet = Nothing
' SQL Update Statement for tblAlias
SQLString = "INSERT INTO tblAlias (user_alias) VALUES ('" & UserAlias & "')"
' Create & Execute Record Set Update for tblAlias
Set RDSet2 = server.createobject("adodb.recordset"
Set RDSet2 = DBConn.execute(SQLString)
' Close Second Record Set
RDSet2.Close
Set RDSet2 = Nothing
' Checks for VBScript Errors
If err.number>0 Then
response.write "VBScript Errors Occured:" & "<p>"
response.write "Error Number=" & err.number & "<p>"
response.write "Error Descr.=" & err.description & "<p>"
response.write "Help Context=" & err.helpcontext & "<p>"
response.write "Help File=" & err.helpfile & "<p>"
response.write "Native Error=" & err.nativeerror & "<p>"
response.write "Source=" & err.source & "<p>"
response.write "SQLState=" & err.sqlstate & "<p>"
End If
' Checks for Database Errors
If DBConn.Errors.Count>0 Then
response.write "Database Errors Occured" & "<p>"
response.write SQL & "<p>"
For each error in DBConn.Errors
response.write(Error.Number & " : " & Error.Description) & "<p>"
Next
Else
response.write "<b>Everything Went Fine! Record is now UPDATED!</b>"
response.write "<br>" & SQL
End If
' Close Database
DBConn.Close
Set DBConn = Nothing
%>
<!-- Used to redirect the user to a thank you page that doesn't appear in frames -->
<script type="text/javascript" language="JavaScript">
parent.location.href='</script>
--------------------------------- Error Message -------------------
ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed.
/~floridasurveys/fpa_survy.asp, line 55
----------------------------- Code --------------------------------
<% LANGUAGE="VBSCRIPT" %>
<!--#include file=includes\DataConn.inc -->
<!--#include file=includes\UserClass.inc -->
<%
' Declare User Variable
Dim UserAlias
' Open UserClass
Dim User
Set User = New UserClass
' Get User's Alias
UserAlias = User.Alias
' Declare Form Variables
Dim asp_qust1, asp_qust2, asp_qust3, asp_qust4, asp_qust5, asp_qust6, asp_qust7, asp_qust8, asp_qust9, asp_qust10
Dim asp_qust11, asp_qust12, asp_qust13, asp_qust14, asp_qust15, asp_qust16, asp_qust17, asp_qust18, asp_commnts
' Assign Values
asp_qust1 = request.form("frm_qust_1"
asp_qust2 = request.form("frm_qust_2"
asp_qust3 = request.form("frm_qust_3"
asp_qust4 = request.form("frm_qust_4"
asp_qust5 = request.form("frm_qust_5"
asp_qust6 = request.form("frm_qust_6"
asp_qust7 = request.form("frm_qust_7"
asp_qust8 = request.form("frm_qust_8"
asp_qust9 = request.form("frm_qust_9"
asp_qust10 = request.form("frm_qust_10"
asp_qust11 = request.form("frm_qust_11"
asp_qust12 = request.form("frm_qust_12"
asp_qust13 = request.form("frm_qust_13"
asp_qust14 = request.form("frm_qust_14"
asp_qust15 = request.form("frm_qust_15"
asp_qust16 = request.form("frm_qust_16"
asp_qust17 = request.form("frm_qust_17"
asp_qust18 = request.form("frm_qust_18"
asp_commnts = replace(request.form("frm_commnts"
' SQL Update Statement for tblFPA_Survey
SQLString = "INSERT INTO tblFPA_Survey (db_qust1, db_qust2, db_qust3, db_qust4, db_qust5, db_qust6, db_qust7, "
SQLString = SQLString + "db_qust8, db_qust9, db_qust10, db_qust11, db_qust12, db_qust13, db_qust14, db_qust15, db_qust16, "
SQLString = SQLString + "db_qust17, db_qust18, db_commnts) VALUES ('" & asp_qust1 & "', '" & asp_qust2 & "', '" & asp_qust3 & "', "
SQLString = SQLString + "'" & asp_qust4 & "', '" & asp_qust5 & "', '" & asp_qust6 & "', '" & asp_qust7 & "', '" & asp_qust8 & "', "
SQLString = SQLString + "'" & asp_qust9 & "', '" & asp_qust10 & "', '" & asp_qust11 & "', '" & asp_qust12 & "', '" & asp_qust13 & "', "
SQLString = SQLString + "'" & asp_qust14 & "', '" & asp_qust15 & "', '" & asp_qust16 & "', '" & asp_qust17 & "', '" & asp_qust18 & "', "
SQLString = SQLString + "'" & asp_commnts & "')"
' Create & Execute Record Set Update for tblFPA_Survey
Set RDSet=server.createobject("adodb.recordset"
Set RDSet = DBConn.execute(SQLString)
' Close First Record Set
RDSet.Close
Set RDSet = Nothing
' SQL Update Statement for tblAlias
SQLString = "INSERT INTO tblAlias (user_alias) VALUES ('" & UserAlias & "')"
' Create & Execute Record Set Update for tblAlias
Set RDSet2 = server.createobject("adodb.recordset"
Set RDSet2 = DBConn.execute(SQLString)
' Close Second Record Set
RDSet2.Close
Set RDSet2 = Nothing
' Checks for VBScript Errors
If err.number>0 Then
response.write "VBScript Errors Occured:" & "<p>"
response.write "Error Number=" & err.number & "<p>"
response.write "Error Descr.=" & err.description & "<p>"
response.write "Help Context=" & err.helpcontext & "<p>"
response.write "Help File=" & err.helpfile & "<p>"
response.write "Native Error=" & err.nativeerror & "<p>"
response.write "Source=" & err.source & "<p>"
response.write "SQLState=" & err.sqlstate & "<p>"
End If
' Checks for Database Errors
If DBConn.Errors.Count>0 Then
response.write "Database Errors Occured" & "<p>"
response.write SQL & "<p>"
For each error in DBConn.Errors
response.write(Error.Number & " : " & Error.Description) & "<p>"
Next
Else
response.write "<b>Everything Went Fine! Record is now UPDATED!</b>"
response.write "<br>" & SQL
End If
' Close Database
DBConn.Close
Set DBConn = Nothing
%>
<!-- Used to redirect the user to a thank you page that doesn't appear in frames -->
<script type="text/javascript" language="JavaScript">
parent.location.href='</script>
--------------------------------- Error Message -------------------
ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed.
/~floridasurveys/fpa_survy.asp, line 55