Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004

    Unanswered: Problem filling form-dropdown <select> with Recordset content.

    Hi there

    Hmm.. i have searched the forums but haven't found anything which have helped out very well.. therefore i try posting here to see if anyone can see what i've done wrong.

    I basically got a <select> field on a ordinary form. Taking out all postnr values from the POSTINFO table, and put everything into the <select>.

    It gives no error, just not printing anything to the field.
    I have testet the database connection with GetRows and the amount of rows is correct..

    using a RecordSet in this case, have tried with Array too but with same result.

    Hope someone can help me out on this..

    ----------------------- START ------------------------
    <%@ Language=VBScript %>
    option explicit
    Dim strConnect

    <!--#include file="DbConnect.asp"-->
    <!--metadata type="typelib" FILE= "C:\Programfiler\fellesfiler\System\ADO\msado15.dl l" -->

    ---------------CONNECTION AND LOOP------------------
    Dim objCommand
    Set objCommand = Server.CreateObject("ADODB.Command")
    objCommand.ActiveConnection = strConnect
    objCommand.CommandType =adCmdText

    <td class="litentekst_gra" width="170">
    Response.Write "<select name='postnr' style='font-family: Helvetica, Arial, Geneva, Swiss, SunSans-Regular ; font-size: 8pt' size='1' >"
    Dim rs, varArray
    objCommand.CommandText = "SELECT postnr from POSTINFO"
    rs = objCommand.Execute

    while NOT rs.EOF
    Response.Write "<option value=" & rs("postnr") & ">" & rs("postnr") & "</option>"
    Response.Write "</select>"
    Best regards

  2. #2
    Join Date
    Nov 2003
    Christchurch, New Zealand
    This may help, but I would have thought your page would have crashed and burned instead of returning nothing
    while NOT rs.EOF
    Response.Write "<option value=" & rs("postnr") & ">" & rs("postnr") & "</option>"
    if that doesn't help you might want to check and see if your recordset is actually being populated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts