查询问题!!!
我要查询每个部门中的员工,member是员工表,其中有u_number,u_name,d_number,sex,tel等属性dept是部门表,其中有d_number,d_name,adress,phone等属性
<!--#include file="conn.asp"-->
<%
dim d_number
d_number=trim(request("d_number"))
if d_number="" then
response.write "输入不能为空"
response.end
end if
set rst=server.createobject("adodb.recordset")
sql="select * from member, dept where d_number="&d_number&" and member.d_number=dept.d_number order by u_number asc" 这句有错误,错误提示:该特定字段 'd_number' 可以参考 SQL 语句中 FROM 子句列表中的多个表
rst.open sql,conn,1,1 请问怎么改???谢谢!!!
%>
<html>
<head>
<title>员工信息列表</title>
</head>
<body>
<img src="image/title.jpg">
<%
if Not(rst.bof and rst.eof) then'判别数据表中是否为空记录
NumRecord=rst.recordcount
rst.pagesize=10
NumPage=rst.Pagecount
if request("page")=empty then
NoncePage=1
else
if Cint(request("page"))<1 then
NoncePage=1
else
NoncePage=request("page")
end if
if Cint(Trim(request("page")))>Cint(NumPage) then NoncePage=NumPage
end if
else
NumRecord=0
NumPage=0
NoncePage=0
end if
%>
<table align="center"border="1" width="60%" bordercolorlight="#000000" cellspacing="0" cellpadding="5" bordercolordark="#FFFFFF">
<tr>
<td align="center" colspan="7" bgcolor="#FFFFCC"><p align="center"><font size="+3" color="#FF3399">所查找的员工信息</font></p></td>
</tr>
<tr>
<td align="center" width="16%">学号</td>
<td align="center" width="16%">姓名</td>
<td align="center" width="16%">性别</td>
<td align="center" width="16%">所在部门</td>
<td align="center" width="16%">联系电话</td>
<td align="center" width="16%">删除</td>
</tr>
<%if Not(rst.bof and rst.eof) then
rst.move (Cint(NoncePage)-1)*10,1
for i=1 to rst.pagesize
%>
<tr>
<td align="center"><%=rst("u_number")%></td>
<td align="center"><a href=veiwmember.asp?u_number=<%=rst("u_number")%>><%=rst("u_name")%></a></td>
<td align="center"><%=rst("sex")%></td>
<td align="center"><%=rst("d_name")%></td>
<td align="center"><%=rst("tel")%></td>
<td align="center"><a href="del_user.asp?u_number=<%=rst("u_number")%>">删除</a></td></td>
</tr>
<% rst.movenext
if rst.eof then exit for
next
else
response.write "<tr><td colspan=7><marquee scrolldelay=120 behavior=alternate>没有找到任何记录!!!</marquee></td></tr>"
end if
rst.close
set rst=nothing
%>
<table width="748" border="0" align="center">
<tr>
<td height="17">
<div align="right">
<input type="hidden" name="page" value="<%=NoncePage%>">
<%
if NoncePage>1 then
response.write "|<a href=user_manage.asp?page=1>首 页</a>| |<a href=user_manage.asp?page="&NoncePage-1&">上一页</a>| "
else
response.write "|首 页| |上一页| "
end if
if Cint(Trim(NoncePage))<Cint(Trim(NumPage)) then
response.write "|<a href=user_manage.asp?page="&NoncePage+1&">下一页</a>| |<a href=user_manage.asp?page="&NumPage&">尾 页</a>|"
else
response.write "|下一页| |尾 页|"
end if
%>
页次:<font color="#0033CC"><%=NoncePage%></font>/<font color="#0033CC"><%=NumPage%></font>
共<font color="#0033CC"><%=NumRecord%></font>条记录 </div></td>
</table>
</body>
</html>