|
 |
asp_databases thread: help on data retrieve from a drop down menu
Message #1 by FungHM <funghm@s...> on Wed, 31 Oct 2001 17:05:52 +0800
|
|
can anyone help me with this? i am using a drop down menu for users to select
data, so what i want to do is when i click on different things from the drop down
menu, i would like to retrieve data from database to the form/page. how do i do
that?? do i need to put the retrieve data into a text box or no need? pls help
thanks..
Message #2 by gbrown@c... on Wed, 31 Oct 2001 11:54:16
|
|
Hi
Depends on exactly what you are trying to do and what controls you are
using.
If you are using select tags for your drop down then you could do a submit
on change to an ASP file that does the read and presents the result.
If you do not want to do a submit then launch a popup in the onchange or
onblur to do the read then have the popup return data via its body onload.
hth
Regards
Graham
> can anyone help me with this? i am using a drop down menu for users to
select
> data, so what i want to do is when i click on different things from the
drop down
> menu, i would like to retrieve data from database to the form/page. how
do i do
> that?? do i need to put the retrieve data into a text box or no need?
pls help
>
> thanks..
Message #3 by "Hiro Shiratori" <hiro-shiratori@m...> on Wed, 31 Oct 2001 09:49:41 -0800
|
|
It could be a combination of someting like this:
Sub btnForm1_onclick()
dim strComName
strComName =3D Replace(Request.Form("Select1"), "'", "''")
strSQL =3D "SELECT * FROM YourTable WHERE Something =3D '" & strComName
&"'"
If Recordset1.isOpen() Then Recordset1.close
Recordset1.setSQLText strSQL
Recordset1.open
End Sub
and
set rsTmp =3D Server.CreateObject("ADODB.Recordset")
rsTmp.CursorType =3D 3
rsTmp.CursorLocation =3D 3
rsTmp.LockType=3D 1
rstmp.ActiveConnection =3D cn
rsTmp.Open "SELECT Something FROM YourTable order by Something"
do until rsTmp.EOF
Response.Write "<OPTION value=3D" & """" & rsTmp("Something") & """" &
">" & rsTmp("Something") & "</OPTION>"
rsTmp.MoveNext
loop
rsTmp.close
cn.Close
set rsTmp =3D nothing
set cn =3D nothing
Hope it helps.
Hiro
----- Original Message -----
From: "FungHM" <funghm@s...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, October 31, 2001 1:05 AM
Subject: [asp_databases] help on data retrieve from a drop down menu
> can anyone help me with this? i am using a drop down menu for users to
select
> data, so what i want to do is when i click on different things from
the drop down
> menu, i would like to retrieve data from database to the form/page.
how do i do
> that?? do i need to put the retrieve data into a text box or no need?
pls help
>
> thanks..
>
hiro-shiratori@m...
$subst('Email.Unsub')
|
|
 |