Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asptoday_discuss thread: Listbox


Message #1 by "Tan Chye Ting" <chyeting18@h...> on Wed, 30 Jan 2002 12:53:21
i'm trying to create a listbox that have options according to the value of 

my recordset...but my coding seems to encounter problems 



"<select name=""PortDel"" size=""2"" style=""HEIGHT: 27px; WIDTH: 

108px"">" 



Dim rsOption

  Set rsOption = Server.CreateObject("ADODB.Recordset")

  strSQL = "Select PortfolioName FROM Portfolio WHERE  ClientID ='1'"

  rsOption.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, 

adCmdTable



while not rsOption.EOF

Response.Write _ 

"<option>" & rsOption("PortfolioName") & "</option>" 

wend



Response.Write _

"</select></td></tr>" & _



the options part cannot execute.what is the problem here?Please help thank 

you
Message #2 by "Patrick" <patrick00@n...> on Wed, 30 Jan 2002 18:22:24 -0000
You just forgot one thing where you have

"<option>" & rsOption("PortfolioName") & "</option>"



put this

"<option value=" & rsOption("PortfolioName")  & ">"  &

rsOption("PortfolioName") & "</option>"



If the portfolioName has spaces in it you will need to UrlEncode the value







----- Original Message -----

From: "Tan Chye Ting" <chyeting18@h...>

To: "ASPToday Discuss" <asptoday_discuss@p...>

Sent: Wednesday, January 30, 2002 12:53 PM

Subject: [asptoday_discuss] Listbox





> i'm trying to create a listbox that have options according to the value of

> my recordset...but my coding seems to encounter problems

>

> "<select name=""PortDel"" size=""2"" style=""HEIGHT: 27px; WIDTH:

> 108px"">"

>

> Dim rsOption

>   Set rsOption = Server.CreateObject("ADODB.Recordset")

>   strSQL = "Select PortfolioName FROM Portfolio WHERE  ClientID ='1'"

>   rsOption.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic,

> adCmdTable

>

> while not rsOption.EOF

> Response.Write _

> "<option>" & rsOption("PortfolioName") & "</option>"

> wend

>

> Response.Write _

> "</select></td></tr>" & _

>

> the options part cannot execute.what is the problem here?Please help thank

> you

>



Message #3 by "Tulip, Nick S" <nick.s.tulip@c...> on Wed, 30 Jan 2002 13:16:07 -0500



	what's the error number, description that you get? Can not continue

because the recordset is closed? ??



-----Original Message-----

From: Patrick [mailto:patrick00@n...]

Sent: Wednesday, January 30, 2002 1:22 PM

To: ASPToday Discuss

Subject: [asptoday_discuss] Re: Listbox





You just forgot one thing where you have

"<option>" & rsOption("PortfolioName") & "</option>"



put this

"<option value=" & rsOption("PortfolioName")  & ">"  &

rsOption("PortfolioName") & "</option>"



If the portfolioName has spaces in it you will need to UrlEncode the value







----- Original Message -----

From: "Tan Chye Ting" <chyeting18@h...>

To: "ASPToday Discuss" <asptoday_discuss@p...>

Sent: Wednesday, January 30, 2002 12:53 PM

Subject: [asptoday_discuss] Listbox





> i'm trying to create a listbox that have options according to the value of

> my recordset...but my coding seems to encounter problems

>

> "<select name=""PortDel"" size=""2"" style=""HEIGHT: 27px; WIDTH:

> 108px"">"

>

> Dim rsOption

>   Set rsOption = Server.CreateObject("ADODB.Recordset")

>   strSQL = "Select PortfolioName FROM Portfolio WHERE  ClientID ='1'"

>   rsOption.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic,

> adCmdTable

>

> while not rsOption.EOF

> Response.Write _

> "<option>" & rsOption("PortfolioName") & "</option>"

> wend

>

> Response.Write _

> "</select></td></tr>" & _

>

> the options part cannot execute.what is the problem here?Please help thank

> you

>




  Return to Index