显示所选人员的记录 [英] Display the record of a selected person

查看:194
本文介绍了显示所选人员的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在根据某些条件从数据库中检索一些名称.然后,这些名称将显示在列表框中.当我选择一个姓名时,该人的详细信息应以相同的形式显示.该人员的姓名和其他详细信息存储在同一张表中.我该怎么办?

请提供代码帮助.........

我的代码如下.........

<%@语言= VBScript%>
<%Response.Buffer = True
%>
< html>
< head>
< title>个人详细信息</title>
</head>
< body>
<%
暗淡
da = date()
昏暗的rs
设置rs = Server.CreateObject(&"ADODB.Recordset&")
rs.Open&"details&",& quot; DSN = Personal& quot;
昏暗yy
昏暗的毫米
昏暗年龄,种姓,rscaste,ageto,性别
age = Request.Form(&"D1& quot;))''(取自另一个asp文件中的另一个表格)
种姓= Request.Form(&"D2&")
ageto = Request.Form(&"D3")
性别= Request.Form(&"R1")
a = cint(年龄)
b = cint(ageto)%>
< form method =& quot; POST& quot; action =&-WEBBOT-SELF->
<!-webbot bot =& quot; SaveResults& quot; u-file =& quot; fpweb:///_private/form_results.csv& quot; s-format =& quot; TEXT/CSV& quot; s-label-fields =&"TRUE&" ->< p>
名称& nbsp;& amp; amp; nbsp; :& nbsp;& amp; nbsp;& amp; nbsp; <选择尺寸=&"1&"名称=&"D1&"尺寸=& quot; 20">
<%虽然不是rs.EOF
''寻找年龄
mm = DateDiff(&"m&",rs(&"DOB&"),da)
如果mm> = 12,则
yy = cint(mm/12)
如果
结束 ''按年龄选择记录
因为我=年龄到年龄
rscaste = rs(&"Caste&")
如果yy = i,那么
''按种姓选择记录
如果种姓= rscaste,那么
''按性别选择记录
如果不是rs(&性别")=性别,则
%>
<选项值="<%= rs(& quot;名称& quot;)%>"<%= rs(& quot;名称& quot;)%> ;</option>
<%
如果
结束 如果
结束 如果
结束 下一个
rs.MoveNext
Wend%</select></form>
<%
rs.Close
Set rs = Nothing
%>
</body>
</html>

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>

推荐答案

双击ListBox.
在列表框的SlelectedIndexChanged事件中,选择
的选定值 列表框.将查询激发到数据库,在WHERE子句中指定列表框值,然后检索数据并将其显示在网格或TextBox中.

希望这足以回答您的问题.
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.


这篇关于显示所选人员的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆