| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 612 人关注过本帖
标题:向高手致敬!关于查询结果循环问题(asp问题)
只看楼主 加入收藏
xiaodpp
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-10-28
结帖率:0
收藏
已结贴  问题点数:20 回复次数:4 
向高手致敬!关于查询结果循环问题(asp问题)
下面是源代码,在多重条件下,有几个条件有问题,一旦选择了,就跳出("对不起,没有您查询条件的会员~!")。问题是在access数据库中有这样的,不知道是什么原因。这几个不正常的是:P_JuZhuDi_Area、P_JuZhuDi_City、P_XueLi、P_Hyzk、XingZuo
让高手们看看,问题在哪里!在这里谢谢大家了!



<!--查询结果循环开始-->

<%
                Dim Action,strWhere,strOrderby
                Dim Sex,minAge,maxAge,P_JuZhuDi_Area,P_JuZhuDi_City,P_Answer1,P_Photo,minHeight,maxHeight,P_XueLi,P_Hyzk,P_MinZu,P_ZongJiao,P_XueXing,P_XingZuo
                Dim ac,bc
                Action=Trim(request("submitok"))
                Sex=Trim(request("sex"))
                minAge=Trim(request("minAge"))
                maxAge=Trim(request("maxAge"))
                P_JuZhuDi_Area=Trim(request("P_JuZhuDi_Area"))
                P_JuZhuDi_City=Trim(request("P_JuZhuDi_City"))
                P_Answer1=Trim(request("LoveType"))
                P_Photo=Trim(request("photo"))
                minHeight=Trim(request("minHeight"))
                maxHeight=Trim(request("maxHeight"))
                P_XueLi=Trim(request("minEducation"))
                P_Hyzk=Trim(request("marrigeStatus"))
                P_MinZu=Trim(request("nationality"))
                P_ZongJiao=Trim(request("religion"))
                P_XueXing=Trim(request("bloodType"))
                P_XingZuo=Trim(request("astrology"))


                If Action="ok" Then
                    strWhere=" And P_CeShi=-1 And P_PingBi=0"
                    If IsNumeric(Sex) Then strWhere = strWhere &" and P_Sex=" & CInt(Sex)
                    Ac=    Year(Now())-Int(minAge)
                    Bc=Year(Now())-Int(maxAge)
                    strWhere = strWhere &" And Year(P_BirthdayTime) BETWEEN "&Bc&" And "&Ac
                    If P_JuZhuDi_Area<>"" Then strWhere = strWhere &" And P_JuZhuDi_Area=" & P_JuZhuDi_Area
                    If P_JuZhuDi_City<>"" Then strWhere = strWhere &" And P_JuZhuDi_City=" & P_JuZhuDi_City
                    If P_Answer1<>0  Then strWhere = strWhere &" And P_Answer1="&P_Answer1
                    If P_Photo="yes" Then strWhere = strWhere & " and P_Photo<>''"
                    If CInt(minHeight) < CInt(maxHeight) Then strWhere = strWhere & " and P_ShenGao <= " & CInt(maxHeight) & " and P_ShenGao >= "&CInt(minHeight)
                    If CInt(P_XueLi)>0 Then strWhere = strWhere & " and P_XueLi="&minEducation
                    If CInt(P_Hyzk)>0 Then strWhere = strWhere & " and P_Hyzk="&marrigeStatus
                    If CInt(P_MinZu)>0 Then strWhere = strWhere & " and P_MinZu="&P_MinZu
                    If CInt(P_ZongJiao)>0 Then strWhere = strWhere & " and P_ZongJiao="&P_ZongJiao
                    If CInt(P_XueXing)>0 Then strWhere = strWhere & " and P_XueXing="&P_XueXing
                    If CInt(P_XingZuo)>0 Then strWhere = strWhere & " and P_XingZuo="&P_XingZuo
                Else
                    strWhere=" And P_CeShi=-1 And P_PingBi=0"
                End If

                Dim order     :    order=CInt(Request("order"))
                Select Case order
                Case 2
                    strOrderby= " order by P_ChengXin desc"
                Case 3
                    strOrderby= " order by P_JiBie desc"
                Case Else
                    strOrderby= " order by P_AddDate desc"
                End Select


               
                Sql="Select * From HH_User where 1=1" & strWhere & strOrderby

                    set rs=Server.CreateObject("ADODB.recordset")
                    rs.open sql,conn,1,1
                    'all_num=rs.recordcount
                    IF  Rs.BOF=True And Rs.EOF =True Then   
                        call msg("对不起,没有您查询条件的会员~!","-1")
                    Else
                         dim page,ipage
                          rs.pagesize=5
                          page=request("Page")
                          pages(page)
                          page=clng(Page)
                          if page > rs.pagecount then response.redirect "./"
                          if page=empty then page=1
                          rs.absolutepage=page
                          for ipage=1 to rs.pagesize
                          dim YangShi_Vip,Vip_jibie
                          Vip_jibie=rs("P_Jibie")
                          YangShi_Vip="class=Aqss_liebiao"
                          Select case Vip_jibie
                              case 0:YangShi_Vip="class=Aqss_liebiao"
                              case 1:YangShi_Vip="class=Aqss_liebiao_vip"
                              case 2:YangShi_Vip="class=Aqss_liebiao_vipcheng"
                          End select
                                '判断诚信任
                          P_ChengXin=rs("P_ChengXin")
                    %>
搜索更多相关主题的帖子: 源代码 access 数据库 会员 
2013-10-28 15:39
hu9jj
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:红土地
等 级:贵宾
威 望:400
帖 子:11857
专家分:43421
注 册:2006-5-13
收藏
得分:5 
测试时可以将多重条件先简化为单一条件,通过之后再逐个添加其他条件,这样就容易排错了。

活到老,学到老!http://www.(该域名已经被ISP盗卖了)E-mail:hu-jj@
2013-10-28 16:58
ywyql_84
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:54
专家分:180
注 册:2011-4-4
收藏
得分:5 
If P_JuZhuDi_Area<>"" Then strWhere = strWhere &" And P_JuZhuDi_Area=" & P_JuZhuDi_Area
If P_JuZhuDi_City<>"" Then strWhere = strWhere &" And P_JuZhuDi_City=" & P_JuZhuDi_City

看下这两个字段的类型,文本型字段,查询条件中加 ''
2013-10-28 19:53
hubowei
Rank: 3Rank: 3
等 级:论坛游侠
威 望:2
帖 子:31
专家分:179
注 册:2012-12-11
收藏
得分:5 
估计是字段格式出了问题,不然不会错

心情半佛半神仙
2013-10-29 19:47
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:5 
call msg("对不起,没有您查询条件的会员~!","-1")
且不说你其他地方有没有问题,这句话就看上去有问题。
2013-11-04 16:17
快速回复:向高手致敬!关于查询结果循环问题(asp问题)
数据加载中...
 
   



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

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