当前位置: 首页 > 图文教程 > 网络编程 > ASP > 用数组实现数据记录的批量录入方法

ASP
如何使用ASP设置指定站点CPU最大使用程度
使用ASP启动/停止指定WEB站点
使用ASP列出NT用户组及用户
如何通过ASP管理NT帐号
使用VB将ASP代码封装到DLL文件
ASP高级技巧精选集
ASP调用存储过程的技巧
使用ASP获得服务器网卡的MAC地址信息
ASP提速技巧 推荐
在不刷新页面的情况下调用远程asp脚本
ASP网页模板的应用: 让程序和界面分离,让ASP脚本更清晰,更换界面更容易
PerlScript编写ASP(转载)
新型ASP后门源代码分析
过滤掉危险的HTML标记:script,ifame,object
如何从数据库中随机取出10条记录的方法
常用ASP函数集【经验才是最重要的】
Tsys OkHtm.com修改版数据采集方法
TsysV1.1 系统文件清单介绍
好久没发布新玩意,完成了tsys的少年不在版
tsys _rss程序

ASP 中的 用数组实现数据记录的批量录入方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 200 ::
收藏到网摘: n/a

  <%
rem 文章题目 asp中利用数组实现数据库记录的批量录入方法(原创)
作者:yanek
联系email:[email protected]
%>

包括两个文件
1。allneeddj.asp:实现表单的生成
2. allneeddjresult.asp 处理表单批量录入
3.hbedu.mdb :数据库文件
其数据库结构如下
provinceid:省份编号 数值型
dytaocount:打样套数 数值型
papertaocount:纸样套数 数值型
cpcontent:出片内容 数值型
filename:文件名 文本型
beizhu:备注  备注型

本例子中以10条记录,每条记录6个字段说明.

1。allneeddj.asp

<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>需求登记</title>
</head>

<body>



<%
set conn=server.createobject("adodb.connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & _
             Server.MapPath("hbedu.mdb")

%>

<form method="POST" action="allneeddjresult.asp">
  <div align="center">
    <center>
  <table border="1" width="700" bordercolorlight="#FFFFFF">
    <tr>
      <td width="660" colspan="6">
        <p align="center">需求登记</td>
    </tr>
    <tr>
      <td width="54" align="center">省份</td>
      <td width="66" align="center">打样张数</td>
      <td width="66" align="center">纸样张数</td>
      <td width="66" align="center">出片内容</td>
      <td width="80" align="center">文件名</td>
      <td width="328" align="center">
        <p align="center">备注</td>
    </tr>
    
    
    <%
rem 通过循环动态生成不同名称表单域
for i=1 to 10
%>
    <%
    set rs=server.createobject("adodb.recordset")
sql="select * from provinceinfo "
rs.open sql,conn,1,1



set rs1=server.createobject("adodb.recordset")
sql1="select * from filename "
rs1.open sql1,conn,1,1
    %>
    
    
    <tr>
      <td width="54"><select name="<% response.write"data1"&i %>"
      size="1">
<%
              do while not rs.eof
                             if province=cstr(rs("id")) then
                                sel="selected"
   &n