爱问知识人 爱问教育 医院库

一个ASP程序找错误

首页

一个ASP程序找错误

写法一
   dim soft,ip
   sql="select * from voteip where ip=' '"  
   set rs= eateobject(" cordset")
   rs.open sql,conn,1,3
   if not( f and rs.eof) then    
      soft=rs("soft")
      response.write rs("ip")&"---"&rs("soft")&"---"&rs("game")&"--"
      response.write soft
      if soft<>1 then
         rs("soft")="1"
         rs.update
          ose
      else
         response.write "<script language=javascript>alert('您已经投过票了!'); ef=' p'</script>"
         response.end
      end if
   else
       response.write "NO"
   end if
写法2
   dim soft,ip
   ip=" "
   sql="select * from voteip where ip="&ip  
   set rs= eateobject(" cordset")
   rs.open sql,conn,1,3
   if not( f and rs.eof) then    
      soft=rs("soft")
      response.write rs("ip")&"---"&rs("soft")&"---"&rs("game")&"--"
      response.write soft
      if soft<>1 then
         rs("soft")="1"
         rs.update
          ose
      else
         response.write "<script language=javascript>alert('您已经投过票了!'); ef=' p'</script>"
         response.end
      end if
   else
       response.write "NO"
   end if
第一种写法就能完成,第二种就不行,为什么?

提交回答
好评回答
  • 2008-10-18 09:07:57
    把方法2的
    sql="select * from voteip where ip="&ip 
    改成
    sql="select * from voteip where ip='"&ip&"'" 
    试试

    婷***

    2008-10-18 09:07:57

其他答案

    2008-10-26 14:31:03
  • 你第二种方法其实就等于写成了:
    sql="select * from voteip where ip= " 
    而你数据库里存储的IP是文本格式,所以就会出错,可以把它改成:
    sql="select * from voteip where ip='"&ip&"'" 

    小***

    2008-10-26 14:31:03

类似问题

换一换
  • 互联网 相关知识

  • 电脑网络技术
  • 电脑网络

相关推荐

正在加载...
最新资料 推荐信息 热门专题 热点推荐
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200

热点检索

  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):