标题:求解
只看楼主
xukeasp
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-4-28
 问题点数:0 回复次数:0 
求解
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>通讯录——查找结果</title>
<style type="text/css">
<!--
body {
    background-color: #FF0000;
}
.STYLE1 {
    font-family: "方正舒体";
    color: #00FF00;
}
.STYLE2 {color: #000000}
-->
</style></head>

<body>
<div align="center">
  <h1 class="STYLE1">通讯录——查找结果  </h1>
</div>
<hr />
<div>
  <div align="center">
    <table width="500" border="1" align="center" bordercolor="#00FFFF" bgcolor="#FFFF00">
      <tr>
        <td width="83" align="center">姓名</td>
        <td width="83" align="center">年龄</td>
        <td width="83" align="center">性别</td>
        <td width="83" align="center">系别</td>
        <td width="83" align="center">班级</td>
        <td width="83" align="center">爱好</td>
      </tr>
        <%
      nam=Request("nam")
      age1=Request("age1")
      age2=Request("age2")
      sex=Request("sex")
      depart=Request("depart")
      clas=Request("clas")
      sport=Request("sport")
      music=Request("music")
      art=Request("art")
      If nam<>""Then s1="AND nam LIKE '%"&nam&"%'"
      If age1<>"" Then s1=s1&"AND age>="&age1
If age2<>"" Then s1=s1&"AND age<="&age2
If sex="m" Then s1=s1 &"AND sex=false"
If sex="f" Then s1=s1 &"AND sex=true"
If depart<>"在所有的系查找" Then s1=s1 &"AND depart='"&depart&"'"
If clas<>""Then s1=s1&"AND clas='"&clas&"'"
If sport="体育"Then s1=s1&"AND hobby LIKE '%体育%'"
If music="音乐" Then s1=s1&"AND hobby LIKE '%音乐%'"
If art="美术" Then s1=s1 &"AND hobby LIKE '%美术%'"
If s1<>"" Then s1="WHERE"&Right(s1,Len(s1)-4)
Set cn=Server.CreateObject("ADODB.Connection")
fn=Server.MapPath("db1.mdb")
cn.Open"driver={Microsoft Access Driver (*.mdb)};dbq="&fn

Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT * FROM tx1" & s1,cn
Do Until rs.EOF
%>
      <tr>
        <td width="63"><a href="look.asp?ID=<%=rs("ID")%>"><%=rs("nam")%></a></td>
        <td align="center"><%=rs("age")%></td>
        <td width="63"><%If rs("sex") Then Response.Write("女") Else Response.Write("男")%></td>
        <td><%= rs("depart") %></td>
        <td><%= rs("clas") %></td>
        <td><%= rs("hobby") %></td>
      </tr>
      <%
      rs.MoveNext
      Loop
      rs.Close
      cn.Close
      Set rs=Nothing
      Set cn=Nothing
      %>
    
    </table>
  </div>
</div>
<p class="STYLE2"><a href="index.asp">返回目录</a></p>
</body>
</html>
运行的时候显示rs.Open "SELECT * FROM tx1" & s1,cn有错误
搜索更多相关主题的帖子: 方正 div 求解 body 
2008-04-28 23:05



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-211558-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.122994 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved