|
|
|
|
|
| | |
| |
vbscript active server pages ASP vbscript SQL database informix oracle SQL Server Perl CGI Delphi PHP source code code sample samples program CJWSoft ASPProtect ASPBanner ASPClassifieds
(Advanced)
(Components)
(Database)
(General)
(Vbscript)

|
|
|
|
Subject: |
Re: displaying drop down from database |
|
From: |
Kal |
|
Date: |
10/5/1999 3:15:56 PM |
|
IP: |
131.107.3.79 |
<html><head>
<TITLE>dblist.asp</TITLE>
</head><body bgcolor="#FFFFFF">
<%
myDSN="DSN=Student;uid=student;pwd=magic"
mySQL="select author from authors where AU_ID<100"
displays a database field as a listbox
set conntemp=server.createobject("adodb.connection")
conntemp.open myDSN
set rstemp=conntemp.execute(mySQL)
if rstemp.eof then
response.write "no data for<br>"
response.write mySQL
conntemp.close
set conntemp=nothing
response.end
end if
%>
<form action="dblistrespond.asp" method="post">
<Select name="authorname">
<%
Now lets grab all the data
do until rstemp.eof %>
<option> <%=RStemp(0)%> </option>
<%
rstemp.movenext
loop
rstemp.close
set rstemp=nothing
conntemp.close
set conntemp=nothing
%>
<input type="submit" value="Choose Author">
</Select></form>
</body></html>
The form responder dblistrespond.asp is:
<html><head>
<TITLE>dblistrespond.asp</TITLE>
</head><body bgcolor="#FFFFFF">
<%
my_author=request.form("authorname")
%>
You choose <%=my_author%><br>Thanks!<br>
</body></html>
|
Previous Message
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|