Forums

ASP

This topic is locked

Multiple select from database

Posted 02 May 2003 08:06:11
1
has voted
02 May 2003 08:06:11 Buddy Quaid posted:
From my code you can probably see what i'm trying to do but it only picks the first one in the loop. I can see why it does this but dont know how to check the list once on the fly so to speak. Please help...code below:

allcolors=split(updateRS.Fields.Item("colors",", "
maxcounter=ubound(allcolors)
FOR counter=0 TO maxcounter
thiscolor=allcolors(counter)
While (NOT rsColors.EOF)
Response.Write("<option value=" & rsColors.Fields.Item("colorID".Value)
if (CStr(rsColors.Fields.Item("colorID".Value) = CStr(thiscolor)) THEN
Response.Write(" SELECTED"
Response.write(">" & rsColors.Fields.Item("title".Value)
else
Response.write(">" &rsColors.Fields.Item("title".Value)
end if
Response.write("</option>" & vbcrlf)
rsColors.MoveNext()
Wend
Next

Replies

Replied 02 May 2003 08:59:24
02 May 2003 08:59:24 Vince Baker replied:
try changing the split code to this:

allcolors=split(updateRS.Fields.Item("colors".value,", ", -1, 1)

Regards
Vince

Visit my home: www.chez-vince.com

VBScript | ASP | HTML | SQL | Oracle | Hosting

Edited by - bakerv on 02 May 2003 09:00:30
Replied 02 May 2003 15:17:02
02 May 2003 15:17:02 Buddy Quaid replied:
That didnt work. What i've also dont is traced the variables to make sure they're pulling up the right count for Maxcounter and the allcolors split thing. So with my code I get the right results from those variables.

I get the right count so that if I have two colors picked for a product in a database it gives me the value of 1.

The problem is that it only selects the first one in the database it sees. This is because it has the count number then cylces through the whole recordset and builds the menu with only one count.

Buddy

Reply to this topic