| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付学习型 ASP/PHP/ASP.NET 主机 30元/年
高端软件开发 = 年薪十万不是梦赛孚耐:软件保护加密专家身份认证令牌USB KEY 
共有 216 人关注过本帖
标题:[求助]两文本框相乘问题?
收藏  订阅  推荐  打印 
zmp
Rank: 2
等级:注册会员
帖子:125
积分:1374
注册:2007-6-30
[求助]两文本框相乘问题?

<form id="form2" name="form2" method="post" action="ckadd.asp">
<table width="720" height="30" border="1" align="center" cellpadding="0" cellspacing="0" bordercolorlight=#cccccc bordercolordark=#ffffff bgcolor=#f1f1f1>
<tr>
<td><div align="center">日期</div></td>
<td><div align="center">商品代码</div></td>
<td><div align="center">商品名称</div></td>
<td><div align="center">单耗量</div></td>
<td><div align="center">件数</div></td>
<td><div align="center">总用量</div></td>
</tr>
<%
dim rs1,exec1,rs2,exec2
exec1="select * from ck_temp"
set rs1=server.CreateObject("adodb.recordset")
rs1.open exec1,conn,1,1

exec2="select zc,ck_date from chmc"
set rs2=server.CreateObject("adodb.recordset")
rs2.open exec2,conn,1,1
%>
<% while not rs1.eof %>
<td><input type="text" name="ck_date" id="get6" style="width:70px; text-align:center" value="<%=rs2("ck_date")%>"></td>
<td><input type="texe" name="spno" style="width:50px;text-align:center" value="<%=rs1("spno")%>"></td>
<td><input type="texe" name="sp_name" style="width:300px;text-align:center" value="<%=rs1("sp_name")%>"></td>
<td><input type="text" name="dh" style="width:50px; text-align:center" value="<%=rs1("dh")%>"></td>
<td><input type="text" name="zc" style="width:50px; text-align:center" value="<%=rs2("zc")%>" </td>
<td><input type="text" name="grl" style="width:50px; text-align:center"></td>
</tr>
<%
rs1.movenext()
wend
%>
</form>

我想
总用量(grl)的值 = 单耗量(dh)*件数(zc)
要怎样来实现呢?
搜索更多相关主题的帖子: 文本  相乘  
2007-8-3 18:30
madpbpl
Rank: 6Rank: 6
等级:金牌会员
威望:6
帖子:2513
积分:27238
注册:2007-4-5

两个表有没有什么关系?
2007-8-3 23:17
madpbpl
Rank: 6Rank: 6
等级:金牌会员
威望:6
帖子:2513
积分:27238
注册:2007-4-5

<!--#include file="数据库链接文件"-->
<form id="form2" name="form2" method="post" action="ckadd.asp">
<table width="720" height="30" border="1" align="center" cellpadding="0" cellspacing="0" bordercolorlight=#cccccc bordercolordark=#ffffff bgcolor=#f1f1f1>
<tr>
<td width="100"><div align="center">日期</div></td>
<td width="104"><div align="center">商品代码</div></td>
<td width="315"><div align="center">商品名称</div></td>
<td width="61"><div align="center">单耗量</div></td>
<td width="61"><div align="center">件数</div></td>
<td width="65"><div align="center">总用量</div></td>
</tr>
<%
dim rs1,exec1,rs2,exec2
exec1="select * from ck_temp"
set rs1=server.CreateObject("adodb.recordset")
rs1.open exec1,conn,1,1

exec2="select zc,ck_date from chmc"
set rs2=server.CreateObject("adodb.recordset")
rs2.open exec2,conn,1,1
%>
<% while not rs1.eof %>
<tr><% total=rs1("dh")*rs2("zc")%>
<td><input type="text" name="ck_date" id="get6" style="width:70px; text-align:center" value="<%=rs2("ck_date")%>"></td>
<td><input type="texe" name="spno" style="width:50px;text-align:center" value="<%=rs1("spno")%>"></td>
<td><input type="texe" name="sp_name" style="width:300px;text-align:center" value="<%=rs1("sp_name")%>"></td>
<td><input type="text" name="dh" style="width:50px; text-align:center" value="<%=rs1("dh")%>"></td>
<td><input type="text" name="zc" style="width:50px; text-align:center" value="<%=rs2("zc")%>"> </td>
<td><input type="text" name="grl" style="width:50px; text-align:center" value="<%=total%>" ></td>
</tr>
<%
rs1.movenext()
wend
%>
</table>
</form>

[此贴子已经被作者于2007-8-3 23:24:14编辑过]

2007-8-3 23:23
zmp
Rank: 2
等级:注册会员
帖子:125
积分:1374
注册:2007-6-30
回复:(madpbpl)

madpbpl谢谢你!在你的指点下可以了
2007-8-4 10:18
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.061608 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved