Multiple select

Results 1 to 2 of 2

Thread: Multiple select

  1. #1
    Join Date
    Dec 1969

    Default Multiple select

    I am using a mutiple select input list. The user carries out selection, and the form is submitted. On submit the selected items are extracted using:<BR><BR>task_no = request.form("task") <BR><BR>great so far, however the returned string is comma delimited and I want to create an entry in the DB for every selected item, not just the complete string. Someone must have done this b4. I am using an sql insert statement but want to split up the comma deliminited arguments.<BR><BR>tia<BR><BR>Mark<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Might be a FAQ on this.

    In fact, you might want to read the FAQ on "Using Checkboxes Effectively" on<BR><BR>But, the long and short of it is:<BR>[code language="VBScript"]<BR>sql = "INSERT INTO Table (Field1, Field2)" & vbCrLf & _<BR> "SELECT " & ID & ", TableField" & vbCrLf & _<BR> "FROM Table" & vbCrLf _<BR> "WHERE TableField IN (" & task_no & ")" & vbCrLf<BR>[/code]<BR>It&#039;ll give you something like:<BR>[code language="T-SQL"]INSERT INTO Table (Field1, Field2)<BR>SELECT 1, TableField<BR>FROM Table<BR>WHERE TableField IN (1, 2, 4, 8)<BR>[/code]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts