Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

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, 13:02
Mirador Mirador is offline
Master Chinchilla
 
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, 20:41
rokslide rokslide is offline
Coffee Minion
 
Join Date: Nov 2003
Location: Sydney
Posts: 1,515
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

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