If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Problem filling form-dropdown <select> with Recordset content.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-08-04, 12:02
Mirador Mirador is offline
Registered User
 
Join Date: Jan 2004
Location: Oslo
Posts: 45
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>"
wend
Response.Write "</select>"
%>
</td>
------------------------------END--------------------------------
__________________
Best regards
Mirador
Reply With Quote
  #2 (permalink)  
Old 10-10-04, 19:41
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
This may help, but I would have thought your page would have crashed and burned instead of returning nothing
Code:
while NOT rs.EOF
Response.Write "<option value=" & rs("postnr") & ">" & rs("postnr") & "</option>"
rs.movenext
wend
if that doesn't help you might want to check and see if your recordset is actually being populated.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On