首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

为什么不能相加?解决方案

2012-02-16 
为什么不能相加??SetRsServer.CreateObject( ADODB.Recordset )sqlselect*fromreply Rs.opensql,con

为什么不能相加??

  Set   Rs   =   Server.CreateObject( "ADODB.Recordset ")  
            sql   =   "select   *   from   reply "
            Rs.open   sql,conn,3,2
    a=1
  xichezongshu   =   a   +   rs( "xichezongshu ")
  '   response.write   xichezongshu
  '   response.end
            Rs.addnew
            Rs( "username ")=username
            Rs( "homeurl ")=homeurl
    Rs( "xichecishu ")=xichecishu
    Rs( "xicheshijian ")=xicheshijian
    Rs( "xichezongshu ")=xichezongshu
            Rs( "replyid ")=replyid
            Rs.update
            Rs.close
            conn.close
            set   Rs   =   nothing
            set   conn   =   nothing
            Response.redirect   "index.asp "
            Response.End


xichezongshu   =   a   +   rs( "xichezongshu ")     不能实现动态的相加了。。为什么?
输出结果都为2


[解决办法]
rs( "xichezongshu ")是什么类型的?
换成
xichezongshu=a+cint(rs( "xichezongshu "))试试
[解决办法]
不可以直接写成xichezongshu = 1 + rs( "xichezongshu ")的吗?
[解决办法]
我说,这个表里的 "xichezongshu "字段的值是不是跟主键 "id "字段一样的?

热点排行