Copy link to clipboard
Copied
I am working with ASPVBscript and Dreamweaver with an access database and IIS. I am trying to pass the values from multiple check boxes on one page to the next page and use those values to filter the results of a recordset on that second page. I am able to pass the values ok and what I end up with is 1,2,3 when I check the first 3 check boxes. I am using the request.form variable and when I print it, that is what I am seeing.
The recordset on the second page is using the following sql:
SELECT *
FROM Table1
WHERE ID IN (MMColParam)
Name: MMColParam
Type: Numeric
Value: Request.Form("cb_membID")
Default Value: 1,2,3
When I test the sql it works fine but when I try to run the pages together, I get the following message:
Error Type:
ADODB.Command (0x800A0D5D)
Application uses a value of the wrong type for the current operation.
/sms1/message.asp, line 19
What im thinking is happening is the value is being passed as text and not as numeric. I suspect there is something I can either ad in my code or change in the request.form to fix this but so far I haven’t been able to figure anything out.
I am quite a novice with this so please be gentle.
My code is below:
1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
2. <!--#include file="Connections/conn_sms.asp" -->
3. <%
4. Dim rs_receipients__MMColParam
5. rs_receipients__MMColParam = "1,2,3"
6. If (Request.Form("cb_membID") <> "") Then
7. rs_receipients__MMColParam = Request.Form("cb_membID")
8. End If
9. %>
10. <%
11. Dim rs_receipients
12. Dim rs_receipients_cmd
13. Dim rs_receipients_numRows
14.
15. Set rs_receipients_cmd = Server.CreateObject("ADODB.Command")
16. rs_receipients_cmd.ActiveConnection = MM_conn_sms_STRING
17. rs_receipients_cmd.CommandText = "SELECT * FROM Table1 WHERE ID IN (?)"
18. rs_receipients_cmd.Prepared = true
19. rs_receipients_cmd.Parameters.Append rs_receipients_cmd.CreateParameter("param1", 5, 1, -1, rs_receipients__MMColParam) ' adDouble
20.
21. Set rs_receipients = rs_receipients_cmd.Execute
22. rs_receipients_numRows = 0
23. %>
24. <%
25. Dim Repeat1__numRows
26. Dim Repeat1__index
27.
28. Repeat1__numRows = -1
29. Repeat1__index = 0
30. rs_receipients_numRows = rs_receipients_numRows + Repeat1__numRows
31. %>
32. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
33. <html xmlns="http://www.w3.org/1999/xhtml">
34. <head>
35. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
36. <title>Untitled Document</title>
37.</head>
38.
39. <body>
40. <p><%= Request.Form("cb_membID") %> </p>
41. <table width="50%" border="0" cellspacing="0" cellpadding="0">
42. <%
43. While ((Repeat1__numRows <> 0) AND (NOT rs_receipients.EOF))
44. %>
45. <tr>
46. <td><%=(rs_receipients.Fields.Item("l_name").Value)%></td>
47. </tr>
48. <%
49. Repeat1__index=Repeat1__index+1
50. Repeat1__numRows=Repeat1__numRows-1
51. rs_receipients.MoveNext()
52. Wend
53. %>
54. </table>
<p> </p>
55. </body>
56. </html>
57. <%
rs_receipients.Close()
58. Set rs_receipients = Nothing
%>
Copy link to clipboard
Copied
Yes, when you pass checkboxes of the same field name what you will get is a comma delimited list/string containing the values of the boxes that were checked. If you need to parse and record these values individually you will need to loop through the list and process the value present in each loop.
This involves a fair amount of code and a lot of it depends on what you wnat done with the values, so I can't be of much help there - but this is the prinile you'll need to follow.
--
Lawrence Carmer - *Adobe Community Professional*
http://www.Cartweaver.com
Complete Shopping Cart Application for
Dreamweaver, available in PHP and ColdFusion
Stay updated - http://blog.cartweaver.com
Find more inspiration, events, and resources on the new Adobe Community
Explore Now