| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 472 人关注过本帖
标题:还是ASP多条件多字段模糊查询的问题,求助
只看楼主 加入收藏
chfmj
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2009-9-17
结帖率:100%
收藏
 问题点数:0 回复次数:0 
还是ASP多条件多字段模糊查询的问题,求助
我上次了问ASP的模糊查询问题,其实没有解决,我给版主的文件错了,没有把搜索结果页给版主,造成文件不能运行,对不起,版主.
我重新上传一个相似的源代码提问一下.如何能多字段多条件查询,比如我要想按输入内容如"李"或"133"只在在第二至第四个字段中查询,而且输入结果能翻页,应该如何更改.谢谢.
TongXun.rar (25.71 KB)

 字段有 ID, name11(姓名), department(部门), zw(职务), phone(办公电话), phone0, phone1, phone2, family
错误结果:
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] 参数不足,期待是3。
/lll/TongXunManage/tongxun_info.asp, 第 10 行


以下是搜索结果页代码

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Conn/conn.asp" -->
<%
Set rs_user = Server.CreateObject("ADODB.Recordset")
sql_user= "SELECT ID, UserName, purview FROM Tab_User WHERE UserName = '"&session("UserName")&"'"
rs_user.open sql_user,conn,1,3
kyw =trim(request("ky"))
Set rs_personnel = Server.CreateObject("ADODB.Recordset")
sql_p= "SELECT ID, name11, department, zw FROM Tab_tongxun WHERE (name11 like '%"&kyw&"%' or department like '%"&kyw&"%' or zw like '%"&kyw&"%' or zw like '%"&kyw&"%' ) order by name11 asc "
rs_personnel.open sql_P,conn,1,3
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.
<html>
<head>
<title>员工信息!</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style.css" rel="stylesheet">
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
}
.style10 {color: #669999}
.STYLE11 {color: #C60001; font-size: 9pt; }
.style12 {
    font-size: 9pt;
    color: #000000;
}
.STYLE13 {
    color: #FF0000;
    font-size: 16pt;
}
.STYLE16 {font-size: 16pt}
.STYLE17 {font-size: 12pt}
-->
</style></head>
<script language="javascript">
function Mycheck()
{
window.location.href='tongxun_top.asp';
}
</script>
<body>
<table width="805" height="515" border="0" cellpadding="0" cellspacing="0" background="../Images/main.gif">
  <tr>
    <td width="805" height="515" valign="top" ><table width="87%" height="84%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="64" valign="top"><table width="270" height="95" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="29" height="62"><div align="center"><img src="../Images/isexists.gif" width="16" height="16"></div></td>
            <td width="241"><span class="style12">通讯信息查询</span></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td>
        <%if rs_personnel.eof then%>
          <table align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td><span class="STYLE13">暂无员工信息!</span></td>
            </tr>
          </table>
          <%else%>
          <table width="680" border="0" cellspacing="-2" cellpadding="-2">
            <tr>
              <td><table width="97%" height="46"  border="1" align="center" cellpadding="-2" cellspacing="-2" bordercolor="#FFFFFF" bordercolorlight="#FFCCCC" bordercolordark="#FFFFFF">
       <tr>
        <td width="13%" height="20"><div align="center"><span class="STYLE17">姓名</span></div></td>
        <td width="16%"><div align="center" class="STYLE17">部门</div></td>
         <td width="10%"><div align="center"><span class="STYLE17">职务</span></div></td>
         <td width="13%"><div align="center"><span class="STYLE17">办公电话</span></div></td>
         <td width="11%"><div align="center"><span class="STYLE17">办公内码</span></div></td>
        <td width="15%"><div align="center"><span class="STYLE17">移动电话</span></div></td>
       <td width="11%"><div align="center"><span class="STYLE17">手机内码</span></div></td>
         <td width="13%"><div align="center"><span class="STYLE17">家庭电话</span></div></td>
      </tr>
      <%
         '分页
        rs_personnel.pagesize=10
        page1=CLng(Request.QueryString("page1"))
        if page1<1 then page1=1
        rs_personnel.absolutepage=page1
        for i=1 to rs_personnel.pagesize
        %><td height="24" valign="middle"><div class="STYLE17">&nbsp;<%=rs_Personnel("name11")%></div></td>
          <td valign="middle"><div class="STYLE17">&nbsp;<%=(rs_personnel("department"))%></div></td>
          <td valign="middle"><div class="STYLE17">&nbsp;<%=(rs_personnel("zw"))%></div></td>
         <td valign="middle"><div class="STYLE177">&nbsp;<%=(rs_personnel("phone"))%></div></td>
          <td valign="middle"><div class="STYLE17">&nbsp;<%=(rs_personnel("phone0"))%></div></td>
          <td valign="middle"><div class="STYLE17">&nbsp;<%=(rs_personnel("phone1"))%></div></td>
          <td valign="middle"><div class="STYLE17">&nbsp;<%=(rs_personnel("phone2"))%></div></td>
          <td valign="middle"><div class="STYLE17">&nbsp;<%=(rs_personnel("family"))%></div></td>
      </tr>
                <%
        rs_personnel.movenext
        if rs_personnel.eof then exit for
        next
        %>
              </table></td>
            </tr>
          </table>
          <%end if %>
          <table width="556" border="0" cellspacing="-2" cellpadding="-2">
            <tr>
              <td><div align="right" class="STYLE11">  
  <% if page1<>1 then %>
   <a href=<%=path1%>?page1=1&branch=<%=Request("branch")%>>第一页</a> <a href=<%=path1%>?page1=<%=(page1-1)%>&branch=<%=Request("branch")%>>上一页</a>
   <%end if
    if page1<>rs_personnel.pagecount then %>
   <a href=<%=path1%>?page1=<%=(page1+1)%>&name11=<%=Request("name11")%>>下一页</a> <a href=<%=path%>?page1=<%=rs_personnel.pagecount%>&name11=<%=Request("name11")%>>最后一页</a>
   <%end if %>

             </div></td>
            </tr>
            <tr>

              <td height="37"><div align="right">
                  <label>
                  <input type="submit" name="button" value="返回" onClick="Mycheck();">
                  </label>
              </div></td>
            </tr>
          </table>
        </td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
搜索更多相关主题的帖子: 条件 模糊 ASP 字段 
2009-09-23 16:45
快速回复:还是ASP多条件多字段模糊查询的问题,求助
数据加载中...
 
   



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

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