Classic ASP VBScript
DWMX
MS Access
WIN XP PRO
Hello. Recently I received assistance from EE regarding "splitting" a comma-delimited list into individual links. That worked well. However, it seems I am needing to take it one step further.
I have one simple form with a few basic fields such as First and Last names and a list of checkboxes corresponding with a dynamic recordset of mentees. The checkboxes are bound to the ID's of any "team_member" with a "tm_Level" of "newhire".
2 tables: [team_members] and [team_mentees]
[team_members] -
{tm_ID} - numeric
{tm_First} - text
{tm_Last} - text
{tm_Mentor} - checkbox of Y or N
{tm_mentee} - comma-delimited list (bound to the value of "tm_ID")
[team_mentees]
{mentee_ID} - text (to be received from the comma-delimited list of "tm_mentee")
{mentor_ID} - numeric (to be received from the "tm_ID" form field)
The following is the code segment I received from EE (which works great):
==========================
==========
==========
==========
==========
==========
=======
<%dim strLinks
strLinks = split(rsMenteeList.Fields.
Item("tm_m
entee").Va
lue, ",")
for i = 0 to ubound(strLinks)
response.write("<a href=""some_process_page.a
sp?MenteeN
umber=" & trim(strLinks(i)) & """>" & trim(strLinks(i)) & "</a><br />")
next%>
==========================
==========
==========
==========
==========
==========
=======
Question:
The form will POST to a process page which needs to add the "mentor_ID" to the [team_mentees] table AND separate each selected checkbox (which corresponds, or is bound, to the "tm_ID" value of any team member with a "tm_Level" of "newhire") and INSERT an individual record for each one in the "mentee_ID" field of the [team_mentees] table.
By using the following "Command" code below, I can get it to write all selected checkboxes to the "mentee_ID" field of the [team_mentees] table, but it is still in comma-delimited format. I am trying to separate them to INSERT as individual records.
================Command on process page to INSERT====================
==========
<%
if(request.form("tm_mentee
") <> "") then addMentee__varMentee = request.form("tm_mentee")
if(request.form("tm_ID") <> "") then addMentee__varMentor = request.form("tm_ID")
%>
<%
set addMentee = Server.CreateObject("ADODB
.Command")
addMentee.ActiveConnection
= MM_connPMDData2_DSN_STRING
addMentee.CommandText = "INSERT INTO team_mentees (mentee_ID, mentor_ID) VALUES ('" + Replace(addMentee__varMent
ee, "'", "''") + "', '" + Replace(addMentee__varMent
or, "'", "''") + "') "
addMentee.CommandType = 1
addMentee.CommandTimeout = 0
addMentee.Prepared = true
addMentee.Execute()
%>
==========================
==========
==========
==========
==========
==========
===
Is this possible? Am I close with the "split" code segment above?
Your help is ALWAYS greatly appreciated!
Thanks so much,
Shane
Start Free Trial