Question
Update multiple records with Update Command Dreamweaver 8.0.2 - ASP VBScript
Dreamweaver 8.0.2 - Language ASP – VBScript
I’m trying to update more than one record at a time using checkboxes. I’ve successfully done this numerous times prior to Dreamweaver 8.0.2.
Before Dreamweaver 8.0.2, I would create a page with a recordset, form, checkbox and repeat region and pass the ID to another page containing an ‘Update Command’. The code on the Update page looked similar to the following:
<%
if(Request.QueryString("MemberID") <> "") then spMemberApproving__MMColParam = Request.QueryString("MemberID")
%>
<%
set spMemberApproving = Server.CreateObject("ADODB.Command")
spMemberApproving.ActiveConnection = MM_connIssuesManager_STRING
spMemberApproving.CommandText = "UPDATE tblMembers SET MemberApproved = 1 WHERE MemberID IN (" + Replace(spMemberApproving__MMColParam, "'", "''") + ")"
spMemberApproving.CommandType = 1
spMemberApproving.CommandTimeout = 0
spMemberApproving.Prepared = true
spMemberApproving.Execute()
Response.Redirect("default.asp")
%>
However, in Dreamweaver 8.0.2 when you fill out the Update Command dialog box, Dreamweaver asks you to provide the ‘Type’ and ‘Size’ for the variables (see: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=4e6b330a ).
That being said and done, the code on the Update page looks like the following:
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<%
if(Request.QueryString("MemberID") <> "") then spMemberApproving__MMColParam = Request.QueryString("MemberID")
%>
<%
Set spMemberApproving = Server.CreateObject ("ADODB.Command")
spMemberApproving.ActiveConnection = MM_connIssuesManager_STRING
spMemberApproving.CommandText = "UPDATE tblMembers SET MemberApproved = 1 WHERE MemberID IN (?) "
spMemberApproving.Parameters.Append spMemberApproving.CreateParameter("MMColParam", 202, 1, 10, MM_IIF(Request.QueryString("MemberID"), Request.QueryString("MemberID"), spMemberApproving__MMColParam & ""))
spMemberApproving.CommandType = 1
spMemberApproving.CommandTimeout = 0
spMemberApproving.Prepared = true
spMemberApproving.Execute()
Response.Redirect("default.asp")
%>
The Update Command works perfectly when only 1 record is being updated. However, when I try to update more than one record I get the following error:
Error Type:
ADODB.Command (0x800A0D5D)
Application uses a value of the wrong type for the current operation.
/issues_manager/admin/members_approving.asp, line 27
Can anyone help me out?
I’m trying to update more than one record at a time using checkboxes. I’ve successfully done this numerous times prior to Dreamweaver 8.0.2.
Before Dreamweaver 8.0.2, I would create a page with a recordset, form, checkbox and repeat region and pass the ID to another page containing an ‘Update Command’. The code on the Update page looked similar to the following:
<%
if(Request.QueryString("MemberID") <> "") then spMemberApproving__MMColParam = Request.QueryString("MemberID")
%>
<%
set spMemberApproving = Server.CreateObject("ADODB.Command")
spMemberApproving.ActiveConnection = MM_connIssuesManager_STRING
spMemberApproving.CommandText = "UPDATE tblMembers SET MemberApproved = 1 WHERE MemberID IN (" + Replace(spMemberApproving__MMColParam, "'", "''") + ")"
spMemberApproving.CommandType = 1
spMemberApproving.CommandTimeout = 0
spMemberApproving.Prepared = true
spMemberApproving.Execute()
Response.Redirect("default.asp")
%>
However, in Dreamweaver 8.0.2 when you fill out the Update Command dialog box, Dreamweaver asks you to provide the ‘Type’ and ‘Size’ for the variables (see: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=4e6b330a ).
That being said and done, the code on the Update page looks like the following:
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<%
if(Request.QueryString("MemberID") <> "") then spMemberApproving__MMColParam = Request.QueryString("MemberID")
%>
<%
Set spMemberApproving = Server.CreateObject ("ADODB.Command")
spMemberApproving.ActiveConnection = MM_connIssuesManager_STRING
spMemberApproving.CommandText = "UPDATE tblMembers SET MemberApproved = 1 WHERE MemberID IN (?) "
spMemberApproving.Parameters.Append spMemberApproving.CreateParameter("MMColParam", 202, 1, 10, MM_IIF(Request.QueryString("MemberID"), Request.QueryString("MemberID"), spMemberApproving__MMColParam & ""))
spMemberApproving.CommandType = 1
spMemberApproving.CommandTimeout = 0
spMemberApproving.Prepared = true
spMemberApproving.Execute()
Response.Redirect("default.asp")
%>
The Update Command works perfectly when only 1 record is being updated. However, when I try to update more than one record I get the following error:
Error Type:
ADODB.Command (0x800A0D5D)
Application uses a value of the wrong type for the current operation.
/issues_manager/admin/members_approving.asp, line 27
Can anyone help me out?