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

新人ASP问题页面值的问题求教...

zywandy 发布于 2013-10-23 16:17, 582 次点击
<%
groupid = request("groupid")
if groupid="" or groupid="undefined" then groupid=1

    Set cs = Server.CreateObject("ADODB.RecordSet")
    sql="select count(*) as cs from agentlog where agentid='"&groupid&"' and housetype =1"
    cs.Open sql,conn,1,1

    Set cz = Server.CreateObject("ADODB.RecordSet")
    sql="select count(*) as cz from agentlog where agentid='"&groupid&"' and housetype =2"
    cz.Open sql,conn,1,1
   
    Set sc = Server.CreateObject("ADODB.RecordSet")
    sql="select count(*) as sc from agentlog where agentid='"&groupid&"' and housetype =0"
    sc.Open sql,conn,1,1

response.write cs("cs")
response.write cz("cz")
response.write sc("sc")

%>

数据库理查出来都有值的..但是我页面上显示就变0了..求高手解释
4 回复
#2
hugeannex2013-10-24 11:16
是access数据库吧?你总得说下你的数据库吧,各个数据库是有点小差异的。
把agentid后的单引号去掉应该就可以了,如
... agentid="&groupid&" and ....
#3
zywandy2013-10-24 11:33
是MY SQL 的数据库..那个groupid字段是字符类型的..去掉'会报错..我现在就是查出来显示是0
#4
hugeannex2013-10-24 11:40
mysql的话,id上是可以加单引号,但不加也不会出错!
但mysql不能用Server.CreateObject("ADODB.RecordSet")吧,理论上是不可以的,这是微软的东西。(但我没试过)
#5
zywandy2013-10-25 15:05
我找到原因了..我 request返回值返回空了..所以查出来为空数据..
1