[thelist] asp LOGIC QUESTION

Tab Alleman talleman at Lumpsum.com
Fri Apr 21 11:09:48 CDT 2006


Ok, first of all, boy are you gonna love .NET.... but anyway, I don't see why you can't just build one big string:

 While Not rsCatagoryList.EOF
	CategoryHTML = CategoryHTML & "<td><SELECT NAME=""txtCatagory" & mid(rsCatagoryList("ID"),2,36) & """ ID=""txtCatagory" & mid(rsCatagoryList("ID"),2,36) & """>"
         Set rsServiceList = Server.CreateObject("ADODB.Recordset")
         strSQL1 = "Select * from Services where catagoryid = " & "'" &
 mid(rsCatagoryList("ID"),2,36) & "'" & " order by name "
        rsServiceList.Open strSQL1, ResourceCatalogDBConn
 
        While Not rsServiceList.EOF
           ServiceListHTML = "<option value=''><-- Choose One
           --></option>" ServiceListHTML = ServiceListHTML1 & "<option
 value='" & rsCatagoryList("ID") & "'>" & rsCatagoryList("Name") &
            "</option>" rsServiceList.MoveNext
         Wend
 CategoryHTML = CategoryHTML & "</SELECT></td>"
         rsCatagoryList.MoveNext
    Wend

And then take your tds and selects out of your html.


thelist-bounces at lists.evolt.org wrote:
> I have a sql record set that contains 12 uids. For each UID I
> want to go
> the servie table and return the services that are under this
> catagory's ID 
> 
> Once I get the list of services I want to dynamically build
> the html for
> display..
> 
> The problem is this: I can loop through the catagory
> recoredset and find
> the services per uid I just am stuck on how to create a dynaic unique
> variable name to hold teh html for each service list.
> 
> The ASP code:
> 
> While Not rsCatagoryList.EOF
>         Set rsServiceList = Server.CreateObject("ADODB.Recordset")
>         strSQL1 = "Select * from Services where catagoryid = " & "'" &
> mid(rsCatagoryList("ID"),2,36) & "'" & " order by name "
>        rsServiceList.Open strSQL1, ResourceCatalogDBConn
> 
>        While Not rsServiceList.EOF
>           ServiceListHTML = "<option value=''><-- Choose One
>           --></option>" ServiceListHTML = ServiceListHTML1 & "<option
> value='" & rsCatagoryList("ID") & "'>" & rsCatagoryList("Name") &
>            "</option>" rsServiceList.MoveNext
>         Wend
> 
>         rsCatagoryList.MoveNext
>    Wend
> 
> The HTML Code:
> 
> <tr>
>       <td height="25" align="right" width="191">Activities /
>        Recreation:</td> <TD>
>                <SELECT NAME="txtCatagory" ID="txtCatagory">
>                             <% =CatagoryHTML %>
>                 </SELECT>
>         </TD>
> </tr>
> 
> any help will be appreciated, thanks
> 
> *
> *
> *
> This message, including any attachments, is intended solely
> for the use of the named recipient(s) and may contain
> confidential and/or privileged information.  Any unauthorized
> review, use, disclosure or distribution of this
> communication(s) is expressly prohibited.  If you are not the
> intended recipient, please contact the sender by reply e-mail
> and destroy any and all copies of the original message.




More information about the thelist mailing list