<%
'申明变量
Dim valName
Dim arrName
Dim objConn
Dim connStr
If Request.Form("mySubmit") = "确定" Then
'数据库链接代码
set objConn=server.CreateObject("ADODB.connection")
connStr = "PROVIDER=SQLOLEDB;Server=(local);DATABASE=test;UID=sa;PWD=123456;"
objConn.Open connstr
'取得值
valName = Cstr(Request.Form("myName"))
'插入数据库
arrName = split(valName,",")
arrPassword = split(valPassword,",")
'执行插入数据库的过程
For i = 0 to Ubound(arrName)
'请自行更改SQL语句
objConn.execute("insert into mytable(sname) values('"&Trim(arrName(i))&"')")
Next
Response.write("数据插入成功")
'关闭数据库连接
objConn.close
Set objConn = nothing
End If
%>
<html>
</head>
<body>
<input type="button" value="增加一条数据" onclick="addIt()" />
<form method="post" action="test.asp" id="myForm">
<div><input type="text" name="myName" /></div>
<input type="submit" value="确定" id="mySubmit" name="mySubmit" />
</form>
</body>
</html>
<script language="javascript" type="text/javascript">
function $(obj){
return document.getElementById(obj);
}
function addIt(){
var myForm = $("myForm");
var mySubmit = $("mySubmit");
var myDiv = document.createElement("div");
var myInput = document.createElement("input");
myInput.setAttribute("type","Text");
myInput.setAttribute("name","myName");
myForm.insertBefore(myDiv,mySubmit);
myDiv.appendChild(myInput);
}
</script>
'申明变量
Dim valName
Dim arrName
Dim objConn
Dim connStr
If Request.Form("mySubmit") = "确定" Then
'数据库链接代码
set objConn=server.CreateObject("ADODB.connection")
connStr = "PROVIDER=SQLOLEDB;Server=(local);DATABASE=test;UID=sa;PWD=123456;"
objConn.Open connstr
'取得值
valName = Cstr(Request.Form("myName"))
'插入数据库
arrName = split(valName,",")
arrPassword = split(valPassword,",")
'执行插入数据库的过程
For i = 0 to Ubound(arrName)
'请自行更改SQL语句
objConn.execute("insert into mytable(sname) values('"&Trim(arrName(i))&"')")
Next
Response.write("数据插入成功")
'关闭数据库连接
objConn.close
Set objConn = nothing
End If
%>
<html>
</head>
<body>
<input type="button" value="增加一条数据" onclick="addIt()" />
<form method="post" action="test.asp" id="myForm">
<div><input type="text" name="myName" /></div>
<input type="submit" value="确定" id="mySubmit" name="mySubmit" />
</form>
</body>
</html>
<script language="javascript" type="text/javascript">
function $(obj){
return document.getElementById(obj);
}
function addIt(){
var myForm = $("myForm");
var mySubmit = $("mySubmit");
var myDiv = document.createElement("div");
var myInput = document.createElement("input");
myInput.setAttribute("type","Text");
myInput.setAttribute("name","myName");
myForm.insertBefore(myDiv,mySubmit);
myDiv.appendChild(myInput);
}
</script>
标签:
asp下实现批量插入数据的方法
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“asp下实现批量插入数据的方法”评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。