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

ASP
asp #include命令
推荐下天枫常用ASP函数封装,推荐大家使用
asp最简单最实用的计数器
用asp实现的iframe批量替换工具
ASPWebPack 代码 提供下载
asp分页生成html的程序脚本代码
比较不错的asp单表单字段多条件查询
asp下用replace非正则实现代码运行功能的代码
UpdatePanel触发javascript脚本的方法附代码
生成EAN13标准的条形码的ASP代码实例
asp空间奸商查询系统
ASPWebPack(整站文件备份系统) v1.0.2 黑客也用
ASP+FSO可视化目录编历(可增、删、改)下载
提高ASP效率的五大技巧
ASP生成随机字符串(数字+大小写字母)的代码
ASP下存储过程编写入门全接触
利用 cache 做对比静态页的网页技术
ASP生成静态文件编码为UTF-8格式的HTML文件
ASP下的两个防止SQL注入式攻击的Function
asp下的风讯用的SQL通用防注入模块提供了

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 233 ::
收藏到网摘: 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