标题:条件语句为什么出错
只看楼主
amethyst9000
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-5-24
结帖率:0
已结贴  问题点数:20 回复次数:2 
条件语句为什么出错
<% bianhao=request("bianhao")
 fs=request("fenshu")
 if bianhao<>"" and fs<>0  then            
              DBPath = Server.MapPath("jsbwsdc.mdb")   
                       Conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath   
                       Set rs = Server.CreateObject("ADODB.Recordset")
                             sql="select * from lll"
                            rs.open sql,conn,1,3
                            rs.addnew
                                  rs("bianhao")=bianhao
                                   Userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
                                   If userip = "" Then userip = Request.ServerVariables("REMOTE_ADDR")
                                   rs("ip")=userip
                            Rs.Update
                            rs.close
                            conn.close
                            set rs=nothing
                            set conn=nothing
                  response.write("<font color=red size=4><img src=jsbpost.gif>信息发布成功啦!<a href=index.htm>返回</a> <a href=find.htm>查询</a></font>")
   else      response.write("<font color=red size=4>请按规定填写完整!(注意:为方便查询管理,节目名称最先填写)<a href=index.htm>返回</a></font>")
  end if
 %>  

 帮我看段代码  为什么当bianhao不为空而fs=0时,程序出错,而不执行else语句呢?,bianhao、fenshu是web页面post过来的值
搜索更多相关主题的帖子: Microsoft 
2011-05-24 09:41
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:10 
bianhao=request("bianhao")
fs=CInt(request("fenshu"))
Request返回的始终是文本值,所以要类型转换一下
2011-05-24 10:15
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
得分:10 
是哪一行?什么错误?

----我怎能在别人的苦难面前转过脸去----
2011-05-24 10:18



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-340808-1-1.html




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

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