Click here to Skip to main content
15,890,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am retrieving some names from a database based on some conditions. The names are then displayed in a listbox. When I select a name, that person's details should be displayed in the same form. The person's name and other details are stored in the same table. How can I do this?

Please help with code.........

My code is as follows.........

<%@ Language = VBScript%>
<% Response.Buffer = True
%>
<html>
<head>
<title>PERSONAL DETAILS</title>
</head>
<body>
<%
Dim da
da = date()
Dim rs
Set rs = Server.CreateObject (&quot;ADODB.Recordset&quot;)
rs.Open &quot;details&quot;, &quot;DSN=Personal&quot;
Dim yy
Dim mm
dim age, caste, rscaste, ageto, gender
age = Request.Form (&quot;D1&quot;) '( Taken from another form in another asp file)
caste = Request.Form (&quot;D2&quot;)
ageto = Request.Form (&quot;D3&quot;)
gender = Request.Form (&quot;R1&quot;)
a = cint (age)
b = cint (ageto) %>
<form method=&quot;POST&quot; action=&quot;--WEBBOT-SELF--&quot;>
<!--webbot bot=&quot;SaveResults&quot; u-file=&quot;fpweb:///_private/form_results.csv&quot; s-format=&quot;TEXT/CSV&quot; s-label-fields=&quot;TRUE&quot; --><p>
Name&amp;nbsp;&amp;nbsp; :&amp;nbsp;&amp;nbsp;&amp;nbsp; <select size=&quot;1&quot; name=&quot;D1&quot; size = &quot;20&quot;>
<% While Not rs.EOF
' FINDING AGE
mm = DateDiff(&quot;m&quot;, rs(&quot;DOB&quot;), da)
if mm >= 12 then
yy = cint(mm/12)
end if
' Selecting records by age
for i = age to ageto
rscaste = rs(&quot;Caste&quot;)
if yy = i then
' Selecting records by caste
if caste = rscaste then
' Selecting records by Gender
if not rs(&quot;Gender&quot;) = gender then
%>
<option value = &quot;<%=rs(&quot;Name&quot;)%>&quot;><%=rs(&quot;Name&quot;)%></option>
<%
end if
end if
end if
next
rs.MoveNext
Wend %></select></form>
<%
rs.Close
Set rs = Nothing
%>
</body>
</html>
Posted
Updated 17-Mar-10 10:50am
v7

1 solution

Double Click On ListBox .
In SlelectedIndexChanged Event of list box , pick the selected value of
List Box. Fire the query to the database, specify the listbox value in the WHERE clause, and retrive the data and display it in grid or TextBox.

Hoping this enough for ur question.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900