日期:2014-05-17  浏览次数:20718 次

ASP 按某值查询MDB数据库,显示出问题
程序如下:

if   Compear_FathCatgId   > =1   then
                set   rs   =   server.createobject( "adodb.recordset ")
                sql   =   "select   *   from   CommodityCatgMiddle   where   Father_CatgId= ' "   &   Compear_FathCatgId   &   " ' "
                rs.open   sql,   conn
        else
                set   rs   =   server.createobject( "adodb.recordset ")
                sql   =   "select   *   from   CommodityCatgMiddle   order   by   GoodsCatgMidID "
                rs.open   sql,   conn
end   if


Do   while   not   rs.eof
        …………………………
<%
rs.movenext
loop

rs.close
set   rs=nothing
conn.close
set   conn=nothing
%>

问题:当运行else中的部分完成正常
但是,运行   Compear_FathCatgId   > =1   时,不能正常显示,但用response.end   在else前可正常结束调试,请问,问题出在那里?

谢谢

小弟新人,分少,请谅解

------解决方案--------------------
1、Compear_FathCatgId在哪定义的?
2、加上if Compear_FathCatgId= " " or isnull(Compear_FathCatgId)then Compear_FathCatgId=0
3、if cint(Compear_FathCatgId) > =1 then
4、rs.open sql, conn,1,1 要加上游标
------解决方案--------------------
Father_CatgId列是字符形的?如果不是就把引号去掉试试。

是SQL的问题,可以查看页面源代码看看是什么错误提示。