asp 怎么实现可以同时添加多条记录

 大家好,我的表单是这样的,就是我同时想录入三条数据,在填完一条以后,

我点击继续添加,再出现一条空的,让我继续添加,

我好急啊,希望各位帮忙,

代码如下

<!--#include file="common.inc"-->
<%
self="inputzqgl.asp"
tabname="tab_2007_5"
TABCAP="辽河油田重点注汽锅炉运行情况表[数据录入]"
%>
<%if session("manager")<>1 then dw=session("dw")%>
<!--#include file="mouse1.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<title><%=tabcap%></title>
<style>
<!--
td         { font-size: 9pt ;text-align=center}
input      { font-size: 9pt }
-->
</style>
</head><script language="javascript" src="menu.js"></script>
<body background="d_102702.gif" leftmargin=0>
<%
if Request.ServerVariables("request_method")="GET" then
%>
<SCRIPT LANGUAGE=vbscript>
<!--
sub message(str)
f1.t.value=str
end sub
sub check()
yn=msgbox("您真的想提交吗?",36,"提示")
If yn=6 Then
  f1.submit
End If
end sub
-->
</SCRIPT>
<script language=javascript>
  function jym(obj)
   {
    if (isNaN(obj.value))
      { 
        alert("日期中含有非法字符!");
  obj.focus();
  obj.select();
   }
     else
     {
     str=obj.value;
      str1=str.substring(0,4);
      str2=str.substring(4,8);
      //obj.value=str2;
     
      if ((str1>9999) || (str1<1) || (str2<1) || (str2>12)||(str.length<8))
                 {
                 alert("日期不正确!")
                 obj.focus();
           obj.select();
                 }
     }
     
   }
  function jy(obj,f)
    {
      if (isNaN(obj.value))
      { 
        alert("请输入数字!");
  obj.focus();
  obj.select();
   }
   else if (obj.value>f)
    {
    alert("输入数字超出范围!");
  obj.focus();
  obj.select();
    }
    }
   
    function jz(obj)
    {
    if (isNaN(obj.value))
      { 
        alert("请输入数字!");
  obj.focus();
  obj.select();
   }

    }
</script>
<form name="f1" action="<%=self%>" method="post">
  <table width="105%" cellspacing="0" cellpadding="0">
    <caption>
    <h1><font face="隶书" color="#000000" size="6"><strong><center>辽河油田重点注汽锅炉运行情况表[数据录入]</center></strong></font></h1>
    </caption>
  <tr><td colspan="3">
  <td align="center" width="30%"><input type="text" name="T" size="40" readonly style="text-align: center"></td><td align=center width="16%"></td>
  <table border="1" width="100%" cellspacing="0" bordercolordark=#FFFFFF bordercolorlight=#000000>
  <tr>
    <td width="6%" rowspan="2" align="center" nowrap bgcolor="#FFCC99"><font size="2">日 期</font></td>
    <td width="9%" rowspan="2" align="center" nowrap bgcolor="#FFCC99"><font size="2">油 田</font></td>
    <td width="11%" rowspan="2" align="center" nowrap bgcolor="#FFCC99"><font size="2">类别1</font></td>   
    <td width="5%" rowspan="2" align="center" nowrap bgcolor="#FFCC99"><font size="2">类别2</font></td>
 <td width="5%" rowspan="2" align="center" nowrap bgcolor="#FFCC99"><font size="2">站号炉号</font></td>
 <td width="5%" rowspan="2" align="center" nowrap bgcolor="#FFCC99"><font size="2">锅炉型号</font></td>
 <td width="5%" rowspan="2" align="center" nowrap bgcolor="#FFCC99"><font size="2">燃料种类</font></td>
 <td width="5%" rowspan="2" align="center" nowrap bgcolor="#FFCC99"><font size="2">燃料消耗量<br>(t)</font></td>
 <td width="5%" rowspan="2" align="center" nowrap bgcolor="#FFCC99"><font size="2">期间注汽量<br>(t)</font></td>
 <td width="5%" rowspan="2" align="center" nowrap bgcolor="#FFCC99"><font size="2">平均排量<br>(t/d)</font></td>
 <td width="5%" rowspan="2" align="center" nowrap bgcolor="#FFCC99"><font size="2">平均干度<br>(%)</font></td>
 <td width="5%" rowspan="2" align="center" nowrap bgcolor="#FFCC99"><font size="2">期间运行时间<br>(小时)</font></td>
 <td width="5%" rowspan="2" align="center" nowrap bgcolor="#FFCC99"><font size="2">有效运行时率<br>(%)</font></td>
 <td width="5%" rowspan="2" align="center" nowrap bgcolor="#FFCC99"><font size="2">备 注</font></td>
  </tr>
   <tr align=center>
           <% if session("manager")=1 then
          set OraSession=createobject("OracleInProcServer.XOraSession")          
    Set OraDatabase = OraSession.createdatabase(orahost,orauser&"/"&orapasswd,0) 
    Set OraDynaset = OraDatabase.CreateDynaset("select danwei from yonghu where manager<>'1' and include='1'",0)
                dwstr=""
   Do
     dwstr=dwstr&" <OPTION value="""&OraDynaset(0)&""">"& mid(OraDynaset(0),2)&" </OPTION>"
     OraDynaset.movenext
   Loop until OraDynaset.eof
   OraDynaset.close
   OraDatabase.close
   dwstr=dwstr&"</SELECT>"
   end if
 function dwoutput (stemp)
     if session("manager")<>1 then
        response.write mid(dw,2)& " <input type=""hidden"" name="""&stemp&"dw"" value="""&dw&""">"
         else
        response.write  "<SELECT name="&stemp&"dw>"&dwstr
     end if
   end function
%>

    <tr align=right>
    <td nowrap align="center" height="57" width="45">

 <input type="text" name="T0" size=10 maxlength=10 value="<%=date%>" style="font-size: 12px" ></td>
    <td nowrap align="center" height="57" width="51"><%dwoutput("")%></td>
    <td width="5%" nowrap>
      <select name="select">
        <option value="燃料结构调整">燃料结构调整</option>
        <option value="勘探局及外部队伍服务">勘探局及外部队伍服务</option>
        <option value="重点区块或重大试验项目">重点区块或重大试验项目</option>
      </select>
          </td>
    <td width="5%" nowrap>
      <select name="select2">
        <option value="齐40块蒸汽驱">齐40块蒸汽驱</option>
        <option value="杜84块SAGD">杜84块SAGD</option>
      </select>
         </td>
    <td width="5%" nowrap><input type="text" name=<%=line%>T5 size="8" maxlength="8" value="0" onFocus="message('数字型字段,99999.99')" οnblur="javascript:jy(this,99999.9999)"> </td>
   <td width="5%" nowrap>
      <select name="select3">
        <option value="YZF50-17-P">YZF50-17-P</option>
        <option value="YZF9-21-P">YZF9-21-P</option>
        <option value="YZF20-17-P">YZF20-17-P</option>
        <option value="YZF20-17-P">YZF20-17-P</option>
        <option value="YZF20-17-P">YZF20-17-P</option>
        <option value="YZF23-17-P">YZF23-17-P</option>
        <option value="YZF11-21-P">YZF11-21-P</option>
        <option value="SF-9.2/17.9-YQ">SF-9.2/17.9-YQ</option>
      </select>
         </td>
   <td width="5%" nowrap>&nbsp;
      <select name="select4">
        <option value="油">油</option>
        <option value="燃气">燃气</option>
        <option value="渣油">渣油</option>
        <option value="混配油">混配油</option>
        <option value="热煤气">热煤气</option>
        <option value="水焦浆">水焦浆</option>
        <option value="煤气">煤气</option>
          </select>
         </td>
    <td width="5%" nowrap><input type="text" name=<%=line%>T6 size="8" maxlength="8" value="0" onFocus="message('数字型字段,99999.99')" οnblur="javascript:jy(this,99999.9999)"> </td>
    <td width="5%" nowrap><input type="text" name=<%=line%>T7 size="8" maxlength="8" value="0" onFocus="message('数字型字段,99999.99')" οnblur="javascript:jy(this,99999.9999)"> </td>
    <td width="6%" nowrap><input type="text" name=<%=line%>T8 size="8" maxlength="8" value="0" onFocus="message('数字型字段,99999.99')" οnblur="javascript:jy(this,99999.9999)"> </td>
    <td width="5%" nowrap><input type="text" name=<%=line%>T9 size="8" maxlength="8" value="0" onFocus="message('数字型字段,99999.99')" οnblur="javascript:jy(this,99999.9999)"> </td>
    <td width="6%" nowrap><input type="text" name=<%=line%>T10 size="8" maxlength="8" value="0" onFocus="message('数字型字段,99999.99')" οnblur="javascript:jy(this,99999.9999)"> </td>
    <td width="5%" nowrap><input type="text" name=<%=line%>T11 size="8" maxlength="8" value="0" onFocus="message('数字型字段,99999.99')" οnblur="javascript:jy(this,99999.9999)"> </td>
    <td width="5%" nowrap><input type="text" name=<%=line%>T12 size="50"  > </td>
 
  </tr>
</table>
      </td>
    </tr>
    <tr><center>
      <td colspan=3 align="center"><br><input type="button" value="提    交" ONCLICK="check()">&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="复    原">&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="继续添加" ONCLICK="check()"></td></center>
    </tr>
  </table>

</form>
<%elseif Request.ServerVariables("request_method")="POST" then%>
<%
dim t(30)
for j=1 to 30
t(j)=null
next

ga=request("T0")
t(1)=cdate(request("T0"))
t(2)=cstr(request("dw"))
t(3)=request("select")
t(4)=request("select2")
t(5)=request("T5")
t(6)=request("select3")
t(7)=request("select4")
t(8)=request("T6")
t(9)=request("T7")
t(10)=request("T8")
t(11)=request("T9")
t(12)=request("T10")
t(13)=request("T11")
t(14)=request("T12")
rq=cdate(year(t(1)) & "-" & month(t(1)) & "-" & day(t(1)))

'rq1=dateadd("m",1,rq)
set OraSession=createobject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSession.createdatabase(orahost,orauser&"/"&orapasswd,0)
Set OraDynaset = OraDatabase.CreateDynaset("select * from "&tabname&" where dw='" & t(2) & "' and to_char(rq,'yyyymmdd')='" & datestr(rq) &"'",0)

if OraDynaset.bof and OraDynaset.eof then
  OraDynaset.dbaddnew
  for j=1 to 14
    OraDynaset.fields(j-1).value=t(j)
  next
  OraDynaset.dbupdate
%>
<p align="center"><strong><font face="宋体" size="4" color="#FF0000">提交成功!</font></strong></p>
<%else%>
<p align="center"><strong><font face="宋体" size="4" color="#FF0000">提交不成功,数据已经存在!</font></strong></p>
<%end if
%>
<%
  OraDynaset.close
  OraDatabase.close 
%>

<%end if%>
<font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><a href="jsnblr.asp" target="_top"><font size="2"></font></a><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</font>
</body>
</html>

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值