Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 23rd, 2004, 02:05 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default how to build an ASP dropdown

I want to make a dropdown using a column from my table in the list of the dropdown.

What's wrong with this?

Code:
<form>
<select size="1" name="D1">
  <option VALUE="0" SELECTED>chapter</option><br>

<%Do while not RS.eof
ResponseWrite "<option VALUE="" & chapter & "">chapter</option><br>"

rs.movenext
loop
      ' Exit the loop when reaching the end of the recordset
'If rs.EOF Then Exit For end if
'next
'end if%>
</select></form>
 
Old December 23rd, 2004, 05:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

You don't seem to be using any columns from your recordset. Also, to have a " at the end of a string you need to add """. Plus you need a . between Response and Write. maybe you want something like this?
Code:
<%Do while not RS.eof
Response.Write "<option value=""" & RS.Fields("ChapterID").Value & """>" & RS.Fields("ChapterName").Value & "</option><br>"

rs.movenext
loop%>
 
Old December 23rd, 2004, 05:08 AM
Authorized User
 
Join Date: Sep 2004
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to nashnash
Default

<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>

<%

Function MakeCombo()
    set conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.Jet.OLEDB.4.0"
    conn.Open "c:/Nwind.mdb" ' change your connection string here
    set rs=Server.CreateObject("ADODB.recordset")
    rs.Open "Select * from Employees", conn 'change your table name .

    do while not rs.EOF ' before this you can check for eof or bof
        Response.Write"<Option>" &(rs("Title")) &"</option>"
        rs.MoveNext()
    loop
End Function
%>

<select>
    <%MakeCombo()%>
</select>
</BODY>
</HTML>
------------

Thanks
Nash

 
Old January 17th, 2005, 02:06 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default

ok thanks

Learning of our true origins.

I feel sorry:

http://www.infowars.com/articles/wor...eknowledge.htm

Foreknowledge of A Natural Disaster
Washington was aware that a deadly Tidal Wave was building up in the Indian Ocean





Similar Threads
Thread Thread Starter Forum Replies Last Post
Nant Build for ASP.net Project with C# SanjuBaba NAnt 1 October 15th, 2008 08:24 AM
Regarding DropDown Lists in Asp.Net venkat_vitala ASP.NET 1.0 and 1.1 Basics 1 January 17th, 2007 09:16 AM
Build Frame set in ASP.NET mistry_bhavin General .NET 1 February 24th, 2005 02:37 AM
How to build crystal report in asp.net Fayazuddin Crystal Reports 0 December 14th, 2004 04:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.