| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 479 人关注过本帖
标题:为什么写入数据库的都是空值,连个0都没有?
只看楼主 加入收藏
ashimaxigo
Rank: 2
等 级:论坛游民
帖 子:29
专家分:17
注 册:2012-12-24
结帖率:75%
收藏
已结贴  问题点数:10 回复次数:2 
为什么写入数据库的都是空值,连个0都没有?

<%
  zhizid=request("flagb")
%>
<table width="877" height="154" align="center" border=1 cellspacing=0 cellpadding=0
 style='border-collapse:collapse;border:none'>
 <tr>
       <td width="25%" align="center">高压侧</td>
       <td width="15%" align="center">档位</td>
       <td width="15%" align="center">A0</td>
       <td width="15%" align="center">B0</td>
       <td width="15%" align="center">C0</td>
       <td width="15%" align="center">误差</td>

    <tr>
        <td width="25%"></td>
       <td width="15%" align="center">
                <%
                  set rs=server.createobject("adodb.recordset")
             sql="select * from zhiz where zhizid="&flagb
      rs.open sql,conn,1,1
            if not rs.eof or rs.bof then
                rs.movefirst
       response.write(rs("gdangwid"))
       rs.movenext
     end if
       %>
      </td>
        <td width="15%" align="center">
                <%
                  set rs=server.createobject("adodb.recordset")
             sql="select * from zhiz where zhizid="&flagb
      rs.open sql,conn,1,1
            if not rs.eof or rs.bof then
                rs.movefirst
       response.write(rs("gya0"))
       rs.movenext
     end if
       %>
      </td>
      <td width="15%" align="center">
                <%
                  set rs=server.createobject("adodb.recordset")
             sql="select * from zhiz where zhizid="&flagb
      rs.open sql,conn,1,1
            if not rs.eof or rs.bof then
                rs.movefirst
       response.write(rs("gyb0"))
       rs.movenext
     end if
       %>
      </td>
      <td width="15%" align="center">
                <%
                  set rs=server.createobject("adodb.recordset")
             sql="select * from zhiz where zhizid="&flagb
      rs.open sql,conn,1,1
            if not rs.eof then
                rs.movefirst
       response.write(rs("gyc0"))
       rs.movenext
     end if
       %>
      </td>
      <td width="15%" align="center">
                <%
                  set rs=server.createobject("adodb.recordset")
             sql="select * from zhiz where zhizid="&flagb
      rs.open sql,conn,1,3
            if not rs.eof or rs.bof then
                rs.movefirst
dim ia,ib,ic,iw  'ia,ib分别为A,B相的数据.iw为误差,计算完毕将ic写入gwuc
                ia=rs("gya0")
                ib=rs("gyb0")
                ic=rs("gyc0")
     if ia>ib>ic then
                     iw=(ia-ic)/ic
                else   
         if ia>ic>ib then
                      iw=(ia-ib)/ib
                else
            if ib>ia>ic then
                      iw=(ib-ic)/ic
                else
                if ib>ic>ia then
                      iw=(ib-ia)/ia
                else  
                   if ic>ib>ia then
                      iw=(ic-ia)/ia
                else   
                     if ic>ia>ib then
                      iw=(ic-ib)/ib
                end if  
            end if
          end if
        end if
      end if
    end if
               
rs.addnew '新增加一条记录
rs("gwuc")=iw '将iw的值传给name字段
rs.update'写入完毕
       end if  
      
set rs=server.createobject("adodb.recordset")
             sql="select * from zhiz where zhizid="&flagb
      rs.open sql,conn,1,1
            if not rs.eof or rs.bof then
                rs.movefirst                                                               
       response.write rs("gwuc")
       rs.movenext
     end if
       %>
      </td>
      </tr>
      </tr>
  </table>

</table>

<table width="877" height="38" align="center" border=1 cellspacing=0 cellpadding=0 style='border-collapse:collapse;border:none'>
      <tr>
          <td width="17%" height="38" border="0" align="center" cellpadding="1" cellspacing="1">试验结论</td>
          <td width="83%" height="38" border="0" align="center" cellpadding="1" cellspacing="1">判断合格与否</td>
          </tr>
</table>
搜索更多相关主题的帖子: 数据库 request border center 
2012-12-28 01:51
lasusu
Rank: 2
等 级:论坛游民
帖 子:6
专家分:20
注 册:2007-3-12
收藏
得分:0 
没看明白sorry

asp可以这样用吗? ia>ib>ic 这个真不知道,没试过。
我只用过 (ia>ib) and (ib>icc) 这种方式。

[ 本帖最后由 lasusu 于 2012-12-29 22:08 编辑 ]
2012-12-29 22:00
lasusu
Rank: 2
等 级:论坛游民
帖 子:6
专家分:20
注 册:2007-3-12
收藏
得分:10 
多回复几次,赚点分。

if not rs.eof or rs.bof then
    rs.movefirst
    dim ia,ib,ic,iw
    ia=rs("gya0")
    ib=rs("gyb0")
    ic=rs("gyc0")
    if ia>ib>ic then '格式错误 iw 等于else里的值
        iw=(ia-ic)/ic
    else   
        if ia>ic>ib then  '格式错误 iw 等于else里的值
            iw=(ia-ib)/ib
        else
            if ib>ia>ic then  '格式错误 iw 等于else里的值
                iw=(ib-ic)/ic
            else
                if ib>ic>ia then  '格式错误 iw 等于else里的值
                    iw=(ib-ia)/ia
                else  
                    if ic>ib>ia then  '格式错误 iw 等于else里的值
                        iw=(ic-ia)/ia
                    else   
                        if ic>ia>ib then  '格式错误 iw 等于else里的值 没有else 所以iw没有值
                            iw=(ic-ib)/ib
                        end if  
                    end if
                end if
            end if
        end if
    end if
    rs.addnew
    rs("gwuc")=iw
    rs.update
end if
2012-12-29 22:28
快速回复:为什么写入数据库的都是空值,连个0都没有?
数据加载中...
 
   



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

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