Populating with arrays
I have ASP form with 3 columns: 2 columns are text fields and 1 column is a Multiple Selection option field. I need to get the values from this form and insert into the database using a stored procedure.
My Form code is as follows:
<FORM name="frmSelect" action='COMP.asp' method='post'>
<DIV style="WIDTH: 760px" align="center">
<table cellpadding=1 border=1 cellspacing=1 width='760'>
<tr>
<td class="Label" width="130">colA</TITLE>
<td class="Label" width="130">ColB</td>
<td class="Label" width="200">ColC</td>
</tr>
<tr>
<%
Dim arrColA
Dim arrColB
Dim arrColC
Dim j,k,s
arrColA = split(strColA, ",")
arrColB = split(strColB, ",")
arrColC = split(strColC, ",")
With response
For I=0 to Ubound(arrColA)
For J=0 to Ubound(arrColB)
.Write("<tr>")
Response.Write("<td><Name='ColA'> " & arrColA(I) & " </td>")
Response.Write("<td><Name='ColB'> " & ColB(J) & " </td>")
.Write ("<td>")
Response.Write("<Select Multiple Name='ColC'>")
For K=0 to Ubound(arrColC)
.Write("<Option Value = '" & arrColC(K) & "'>" & arrColC(K) & "")
Next
.Write ("</td>")
Next
Next
Response.write ("</tr>")
End with
%>
<TABLE align = "left" bgColor=white border=0 cellPadding=10 cellSpacing=0 width=50%>
<TR>
<TD>
<INPUT type=hidden name='hdnSaveButton' value='Y'>
<INPUT type="submit" value="Save" name="btnSave">
</TD>
<TD>
<input type="button" value="Refresh" onClick="history.go()" id=button1 name=button1>
</TD>
</TR>
</TABLE>
</Form>
The SP cod is as follows:
call objData.addParameters("@ColA",adVarChar,adParamInp ut,30,strcolA)
call objData.addParameters("@ColB",adChar,adParamInput, 4,strColB)
call objData.addParameters("@ColC",advarchar,adParamInp ut,30, strColC)
objData.ExecuteSP("SP_INSERT_UPDATE")
The doubts I am having are as follows:
1) How do I get the request.form variables and assign it to the strings to execute the SP?
That is strColA, StrColB and StrColC (Col C will be an array again because of multiple select).
Any help will be great .
Thanks
|