数据查询..急!!!
查询文件A.asp 显示文件B.asp,数据库表A,表B,通过字段ncid实现1对多关系,, 现通过文件A中表单form装入表A,查询表B,如下相关代码,请高手指教
A.asp中表单:
...
<form method="POST" action="B.asp">
<select name="ncate">
<option selected value="">所有</option>
<% Set rs = Server.CreateObject("ADODB.Recordset")
sql="Select * From A"
rs.Open sql,conn,1,3
Do While Not rs.EOF
Response.Write "<option value=" & rs("ncid") & ">" & rs("name") & "</option>"
rs.MoveNext
Loop %>
</select>
<input type="submit" value="提交" name="B1" class="button"></p>
</form>
...
B.asp中显示:
...
<%
dim ncid
if session("ID")="" then
session("ID") =Cint(Request.form("ncate"))
end if
ncid=session("ID")
set rs=Server.Createobject("ADODB.Recordset")
sql="select A.*,B.* from B A,hrhy_l2info B where A.ncid=B.ncid AND A.ncid='"&ncid&"'"
rs.open sql,conn,1,1
%>
...
出现问题:
查询多个项出现一样的结果.
[此贴子已经被作者于2007-1-3 13:22:21编辑过]