|
|
|
|
|
| | |
|
Active Server Pages asp source code database MS SQL MS Access .mdb adovbs.inc cookies calendar codes sql commands scripts asp programming tutorials iis web server components CJWSoft ASPProtect ASPBanner ASPClassifieds
(Advanced)
(Components)
(Database)
(General)
(Vbscript)

|
|
Subject: |
Re: db example dropdown menu |
From: |
umesh |
Date: |
9/21/2000 5:24:17 PM |
IP: |
12.25.60.250 |
hi rob,
this is how you do it
all you need to do is create two asp pages say test1.asp and test2.asp
on the first page open the connection to the database,populate the dropdown box with data and create a submit button
on the second page say request.form("option name")
open an connection
write a query and pass this value.
sample
test1.asp:-
<%@ Language=VBScript %>
<%
set con=server.CreateObject ("ADODB.Connection")
con.Open "FileDSN=engdemo1"
set rs=server.CreateObject ("ADODB.Recordset")
sql="select * from ctv_items"
rs.Open sql,con,1,3
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<FORM action="test1asp.asp" method=POST id=form1 name=form1>
<SELECT id=select1 name=select1 style="HEIGHT: 22px; WIDTH: 188px">
<%Do while not rs.EOF%>
<OPTION value=<%=rs.Fields("ITEM_TYPE")%>><%=rs.Fields("ITEM_TYPE")%>
<% rs.MoveNext
loop
%>
</OPTION>
</SELECT>
<INPUT type="submit" value="Submit" id=submit1 name=submit1>
</FORM>
<%con.Close%>
</BODY>
</HTML>
test2.asp:-
<%@ Language=VBScript %>
<% a=Request.Form("select1")
set con1=server.CreateObject ("ADODB.Connection")
con1.Open "FileDSN=engdemo1"
set rs1=server.CreateObject ("ADODB.Recordset")
sql1="select * from ctv_items where item_type=" & a & ""
Response.Write sq |
Previous Message
|
|

|
|
|
|
|
|
|
|
|
|