VisualBuilder
  Home > Asp > Tutorials > Populating a dropdown list from a database - ASP Tutorial
Tell a friend
Link to us
Total Members
      Members: 84705
     
Sitemap Forum Chat
Home
ASP Tutorial Home
1 . Introduction to ASP
2 . Setting up your ASP environment
3 . First ASP Page
4 . Active Server Objects
5 . Global.asa
6 . Application Object
7 . Session Object
8 . Request Object
9 . Response Object
10 . Server Object
11 . ASP Server Side Includes
12 . Connecting to a database
13 . Returning a recordset from a database
14 . Formatting a recordset as a HTML table
15 . Populating a dropdown list from a database
16 . Creating an automated email
17 . Sending attachments via an automated email
18 . What is the FileSystemObject?
19 . Total number of users are accessing the ASP application?
20 . Logging users
 
 
ASP Home
ASP Members (23087)
ASP Member Articles ( 29 )
ASP Discussion (86)
ASP Q & A ( 5 )
- ASP Ask Question
- ASP Questions
- ASP Unanswered Questions
ASP Resources
ASP Source Code (238)
ASP Articles (405)
ASP Blogs (0)
ASP Jobs (0)
ASP Components (493)
ASP Books (6)
ASP Websites (228)
ASP News (64)
 
GROUPS
.NET
ASP.NET
.NET
C#
ASP
Visual Basic
Java
Java
JSP
EJB
Other
Delphi
C++
Ajax
UML
JavaScript
PHP
Web Design
Web Hosting
SQL Server
Oracle
Project Management
More Groups

 
LEARNING CENTER
TUTORIALS
.NET
.NET Tutorial
ASP Tutorial
ASP.NET Database Tutorial
ASP.Net Security,Internationalisation And Deployment
ASP.NET Tutorial
C# Tutorial
Web Development
Flex Tutorial
HTML Tutorial
Learn AJAX Tutorial
PHP Tutorial
Software Development
Database Tutorial
SQL Tutorial
UML Tutorial
Java
Ant Tutorial
EJB 3 Tutorial
Hibernate Tutorial
Java Tutorial
Java Web Component Tutorial
Java XML Tutorial
JDBC Tutorial
JDK1.5 Tutorial
JSF Tutorial
JSP And J2EE Design Tutorial
JSP Tutorial
Spring Tutorial
Struts Tutorial

RESOURCES
Q & A (451 )
Source Code (3275 )
Articles (359 )
Books (372 )
Components (1596 )
News (892 )
Websites (1207 )

SUBMISSIONS
Submit Article
Submit Website
Submit News
Submit Source Code
Submit Component

COMMUNITY
Members Directory
Discussion Forum
Chat

SITE
About Us
Sitemap
Search
Contact Us
Link To Us
Feedback
Tell a Friend
Partners
Advertise

Asp Tutorial
 Populating a dropdown list from a database
  << Prev: Formatting a recordset as a HTML table Next: Creating an automated email >>

To populate a dropdown list from a database table,first open a recordset and read from it one record at a time and dynamically write a html dropdown list.



 










<%@ Language=VBScript %>

<!-- #include file="adovbs.inc" -->

<% 'Create the recordset

set conn=server.createobject("adodb.connection")

set rs = Server.CreateObject("ADODB.Recordset")

conn.open session("connection_string")

set rs = conn.execute("select * from tblEmployee")

%>


<html>


<head>


<title>


</title>


</head>


<body>


<select name="Employee" size="1">



<% 

do while not rs.eof %>



<%

response.write "<option value=" + Cstr(rs("EmpID")) +">" + rs("EmployeeName")+ "</option>"

rs.movenext

loop

%>


</select>


<% rs.close

set rs=nothing

conn.Close

set conn = nothing %>







</body>


</html>





  << Prev: Formatting a recordset as a HTML table Next: Creating an automated email >>
Asp Tutorial Home
Give feedback and win a prize.

 
   Printer Friendly
   Email to a friend
   Add to my Favourites    
  Download PDF version
   Report Bad Submissions
   Submit Feedback
 
  Delicious   Digg   Technorati   Blink   Furl   Reddit   Newsvine   Google Click each image to add
this page to each site.
 
 
Welcome Guest Signup
MEMBER'S PANEL
EMAIL
PASSWORD
Forgot your password?
New User? Click Here!
 
Resend Activation Email!
 
SEARCH
 
conference call
MSN
Video Surveillance
VoIP Internettelefonie
 
 
ADVERTISEMENT
Partner List
Code Project
ASP Alliance
More
 
 
 
 

Home | Login | About Us | Contact Us | Privacy Policy | Advertising