Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 13th, 2004, 06:04 PM
Registered User
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
 
Old October 14th, 2004, 02:26 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

So on Request.Form(colC) value you would get values separated by commas. Check out this thread. That should be what you are looking for.

Dynamic stored procedure

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
arrays Abraham Java Basics 5 April 11th, 2009 11:10 PM
arrays ozPATT Excel VBA 2 November 4th, 2005 06:11 AM
Multidemmesional Arrays OR arrays gmoney060 Classic ASP Basics 3 November 1st, 2004 03:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.