日期:2013-02-17  浏览次数:20950 次

  当我们有时在添加新记录时,一次添加一条的操作很不方便,尤其是在录入大批量的数据时,比如:学生成绩。
   下面是我给一个客户做的自定义添加记录数(即:用户可以自己选择当前一次添加多少条记录),并用vb函数对每个需要输入的文本框做了检查。

下面是源程序:

<%@ Language=VBScript %>
<%
'文件名:dd_product_price.asp
'功能:添加商品价格详细资料
'说明:后台程序
'程序:小白
'时间:2002-5-15
'更新:
'更新说明:
'公司:坐标公司
'主页:www.zbhn.com
%>

<HTML>
    
<HEAD>
<title> <%=application("web_name")%> --->添加商品价格资料</title>
<META NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
<style type="text/css"> <!-- a:link {color:darkslateblue;text-decoration:none}
    a:visited {color:darkslateblue;text-decoration:无}
    a:hover {color:brown;text-decoration:底线}
    input.radio {background: navyblue; color:#000000}
    font { font-size: 9pt; line-height: 13pt; FONT-FAMILY:MS Shell Dlg,Tahoma}
    td { font-size: 9pt; line-height: 13pt; FONT-FAMILY:MS Shell Dlg,Tahoma}
    textarea { BACKGROUND-COLOR: #e8e8e8; BORDER-BOTTOM: 1px double; BORDER-LEFT: 1px double; BORDER-RIGHT: 1px double; BORDER-TOP: 1px double; COLOR: #000000;; font-size: 9pt ;FONT-FAMILY:MS Shell Dlg,Tahoma}
    input { BACKGROUND-COLOR: #e8e8e8; BORDER-BOTTOM: 1px double; BORDER-LEFT: 1px double; BORDER-RIGHT: 1px double; BORDER-TOP: 1px double; COLOR: #000000;; font-size: 9pt; FONT-FAMILY:"MS Shell Dlg", "Tahoma"; background-position: center}
    --></style>
<SCRIPT LANGUAGE="javascript" src="js/refuse_visit.js"></SCRIPT>
<SCRIPT LANGUAGE="javascript" src="js/max_window.js"></SCRIPT>
</HEAD>
    <body>
        <!--#include file="sjkpzwj/ytxx_conn.inc"-->
        <p align="center">
            <%
            dim url
            url=request.ServerVariables("SCRIPT_NAME")
    on error resume next
    record=request.QueryString("record")
    if record="" then
    record=1
    end if
    record=cint(record)
    if Err.number <> 0  then
    record=1
    Response.Write "操作不当,请下次小心点"
    end if
if Request.ServerVariables ("Request_Method")="POST" then                    
'如果提交过来的是post方法,则添加记录到数据库

dim text1(20),text2(20),text3(20),text4(20)

'______________________
sub gave_value(text,xx)
on error resume next
count=0
for each item in Request.Form(text)
xx(count)=item
count=count+1
next
if Err.number <> 0 then

response.Write "sub err:"& Err.Description
end if
end sub
on error resume next
'____________________
call gave_value("text1",text1)
call gave_value("text2",text2)
call gave_value("text3",text3)
call gave_value("text4",text4)
if Err.number <> 0 then
response.Write "call sub err:"&Err.Description
end if

'%%%%%%%%%%%%%%%%%%%%%%%%
on error resume next

if Err