Skip to main content
Participant
February 1, 2007
Question

Update multiple records with Update Command Dreamweaver 8.0.2 - ASP VBScript

  • February 1, 2007
  • 1 reply
  • 1335 views
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?
This topic has been closed for replies.

1 reply

Inspiring
February 1, 2007
Yes, this is a bug in Dreamweaver 8.0.2. The only workaround is to stay with
8.0.1 or to hand-code the query. Adobe removed most of the useful ways to
use Commands and Recordsets in 8.0.2 and limited it to basic queries.


--
Tom Muck
co-author Dreamweaver MX 2004: The Complete Reference
http://www.tom-muck.com/

Cartweaver Development Team
http://www.cartweaver.com

Extending Knowledge Daily
http://www.communitymx.com/



"Button1" <web.weenie@sympatico.ca> wrote in message
news:epsosk$3g9$1@forums.macromedia.com...
> 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?
>
>


Button1Author
Participant
February 1, 2007
Thanks Tom,

I’ll stop beating my head against the wall now. Thought it was me. Unfortunately at this point in time I cannot go back to 8.0.1 – it has been completely removed from my computer... And, I'm not quite sure how to hand-code the query. I tried the exact code used previously and sorry to say I get the following error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
/issues_manager/admin/members_approving.asp, line 21


PS love your extensions. I cannot work without: Dynamic Search, Sort Repeat Regions and Recordset Nevigation


Bill Charrette - ipopper.net