asp网页怎么同时插入多条记录,我想在文本框C里输入多少就插入多少条记录
代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="file:///D|/jinglingchuan/Connections/rw.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
If (CStr(Request("MM_insert")) = "form1") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_rw_STRING
MM_editCmd.CommandText = "INSERT INTO task (hy_name, hy_qq) VALUES (?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 30, Request.Form("a")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 20, Request.Form("b")) ' adVarWChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
End If
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<form id="form1" name="form1" method="POST" action="<%=MM_editAction%>">
<p> </p>
<p>
<label for="a"></label>
<input type="text" name="a" id="a" />
</p>
<p>
<label for="b"></label>
<input type="text" name="b" id="b" />
</p>
<p>
<label for="c"></label>
<input type="text" name="c" id="c" />
</p>
<p>
<input type="submit" name="button" id="button" value="提交" />
</p>
<input type="hidden" name="MM_insert" value="form1" />
</form>
</body>
</html>
在数据库里写个存储过程或者这个INSERTED触发器