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

查询时查不到 id1 和id为最后一个数据

罗林鹏 发布于 2010-08-30 18:29, 397 次点击
我有一个asp显示页面。数据 是数据库某一个表中的,显示是全部显示了。但是我查询时 就是查不到id为1和id为最后的数据。  提示: 就是显示了全部数据,就是查不到id为1和id为最后的数据。  下面一个是我的查询条件 。后面那个不怎么懂。- -
程序代码:
<script language="javascript">
function jumpTo(i){
if(i==1){
   
this.document.location="chakanfangyingdui.asp?sheng=<%=sheng%>&shi=<%=shi%>&xian=<%=xian%>&gjz=<%=gjz%>&gs=<%=gs%>";}
if(i==2){
   
this.document.location="chakanfangyingdui.asp?page=<%=page-1%>&sheng=<%=sheng%>&shi=<%=shi%>&xian=<%=xian%>&gjz=<%=gjz%>&gs=<%=gs%>";}
if(i==3){
   
this.document.location="chakanfangyingdui.asp?page=<%=page+1%>&sheng=<%=sheng%>&shi=<%=shi%>&xian=<%=xian%>&gjz=<%=gjz%>&gs=<%=gs%>";}
if(i==4){
   
this.document.location="chakanfangyingdui.asp?page=<%=rs.pageCount%>&sheng=<%=sheng%>&shi=<%=shi%>&xian=<%=xian%>&gjz=<%=gjz%>&gs=<%=gs%>";}
}
function addlineeffect(id,element)//获取ID为id的对象下的所有element元素!
{
var tr=[];
tr
=document.getElementById(id).getElementsByTagName(element);
   
for(var i=0,j=tr+1.length;i<j;i++)
   {
     tr[i].onmouseover
=function(){
      
this.style.backgroundColor='#B9D5FF';
                                 }
     tr[i].onmouseout
=function(){
      
this.style.backgroundColor='';
                                 }
   }
}
</script>
程序代码:
<%
sheng
=request("sheng")
shi
=request("shi")
xian
=request("xian")
gjz
=request("gjz")
gs
=request("gs")
page
=Request("page")
px
=request("px1")
if request("sheng")="省份"  then sheng=""
if request("shi")="地级市"  then shi=""
if request("xian")="市、县级市、县"  then xian=""

if sheng="" and shi="" and xian="" and gjz="" and page=""  and px="" and gs="" then
    sql
="SELECT * FROM fyd  order by id desc"
else
    sql
="SELECT * FROM fyd where sheng like '%"&sheng&"%' and  shi like '%"&shi&"%' and xian like '%"&xian&"%' and dz like'%"&gjz&"%' and gsmc like'%"&gs&"%' order by sheng "&px&", id desc"
end if
%>
2 回复
#2
cnfarer2010-08-31 07:35
恐怕是输出问题?!你代码也不全.
order by sheng "&px&",id 这个什么意思?如果有了PX值的话,有可能出错吧?
#3
gupiao1752010-08-31 17:05
直接把SQL语句输出,到数据库看看,一般输出后,你认真分析就能看出问题所在!既然问题是无法查id=1和最后的数据,那么你就直接拿到数据库里执行,自然就能看出其中端倪!
1