This topic is locked
[SOLVED]

 Multiple values from checkboxes to individual database e

2/4/2010 7:38:25 PM
ASPRunnerPro General questions
C
codywallace author

I am attempting to use the sample event from the ASPRunnerPro 6.1 manual titled "Select multiple values from checkboxes or a list field and have them appear as individual database entries" but when I use the code verbatim, replacing the red text with my field names, I receive an IE error message "Error Type: Microsoft VBScript runtime (0x800A01A8) Object required: 'arr'".
There are two tables
Members

  • MemberID
  • MemberName
    Events
  • EventID
  • MemberID
  • Event
    My intent is to be able to create one Event while associating multiple Members to the Event, each with his/her own record.
    Here is the code I am using:

Dim arr

if values("MemberID")<>"" then

arr = Split(values("MemberID"),",")

' This is the name of the multi check box or

' list select field, its value becomes $arr

for i=0 to arr.Count

strInsert = "insert into Events (MemberID) values ('" & arr(i) & "')"

' add more fields from the add page to be inserted into database
dbConnection.Execute strInsert

next
Response.Redirect "Events_list.asp"

' Exit and Redirect to the list page after updating database

exit function

end if


To test the scenario, I have used fields for MemberID that were first number then again as text. I even tried creating a "List of values". All attempts resulted in the same results. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=13715&image=1&table=forumtopics' class='bbc_emoticon' alt=':(' />
Guidance as to where I am going wrong would be greatly appreciated.
Thank you.

Sergey Kornilov admin 2/4/2010

This appears to be a bug in sample code.
Instead of

for i=0 to arr.Count


use

for i=lbound(arr) to ubound(arr)
C
codywallace author 2/5/2010

Dear Sergey,
Thank you, that was the problem. I have another question regarding using the Checkbox list but will post it in a new thread so as not to confuse topics.
Thanks again.
Cody