注册 登录
编程论坛 ASP技术论坛

请教如何在单表单段查询上加入多段查询?

a190066 发布于 2010-06-26 13:33, 499 次点击
请问如何在以下的单表单段(question)关键查询里加入“question1”、“question2”二个段进行多段关键字查询?谢谢!

<%
 if request("userid123")="" then
 sql="select * from users order by id desc"
 else
 sql="select * from users where question='"&request("userid123")&"'"
 end if
 Set rs= Server.CreateObject("ADODB.Recordset")
 rs.open sql,conn,1,1
  if rs.eof and rs.bof then
       response.write "<p align='center'>你查的这个内容不存</p>"
   else
      totalPut=rs.recordcount
      totalPut=rs.recordcount
      if currentpage<1 then
          currentpage=1
      end if
      if (currentpage-1)*MaxPerPage>totalput then
       if (totalPut mod MaxPerPage)=0 then
         currentpage= totalPut \ MaxPerPage
       else
          currentpage= totalPut \ MaxPerPage + 1
       end if

      end if
       if currentPage=1 then
           showpage totalput,MaxPerPage,"Find-8a.asp"
            showContent
            showpage totalput,MaxPerPage,"Find-8a.asp"
       else
          if (currentPage-1)*MaxPerPage<totalPut then
            rs.move  (currentPage-1)*MaxPerPage
            dim bookmark
            bookmark=rs.bookmark
           showpage totalput,MaxPerPage,"Find-8a.asp"
            showContent
             showpage totalput,MaxPerPage,"Find-8a.asp"
        else
            currentPage=1
           showpage totalput,MaxPerPage,"Find-8a.asp"
           showContent
           showpage totalput,MaxPerPage,"Find-8a.asp"
          end if
       end if
   end if
   sub showContent
       dim i
       i=0

  %>

3 回复
#2
o仰o2010-06-26 18:26
sql="select * from users where question='"&request("userid123")&"'"  后面加个OR多个条件
#3
a1900662010-06-26 20:32
回复 2楼 o仰o
可否详细一点?谢谢!
#4
a1900662010-06-27 02:05
hams  我刚入门。你在那,帮我一把吧。谢谢你。请教如何在单表单段查询上加入多段查询?
1