ASP如何把多行数据同时添加到数据库,表单时一样的,为了不一个一个的提交!
<%IfAction="Save"ThenTel=CheckSql(Trim(Request.Form("Tel")))body=CheckSql(Trim(Reques...
<%
If Action = "Save" Then
Tel = CheckSql(Trim(Request.Form("Tel")))
body = CheckSql(Trim(Request.Form("body")))
'---------------------------
Set Rs = Conn.Execute("Select * From ["&dodeTable&"] where Tel='"&Tel&"'")
If Not Rs.Eof Then ClMsg "不允许重复电话!","MemberNote.asp"
'---------------------------
Set Rs=Server.CreateObject("Adodb.RecordSet")
Rs.Open "Select * From [dode_MemberNote]",Conn,1,3
Rs.AddNew
Rs("MemberID") = Int(Session("MemberID"))
Rs("ItemName") = ItemName
Rs("body") = body
Rs("UserName") = Trim(Request.Form("UserName"))
Rs("ItemName") = Trim(Request.Form("ItemName"))
Rs("Sex") = Trim(Request.Form("Sex"))
Rs("Tel") = Trim(Request.Form("Tel"))
Rs("Add") = Trim(Request.Form("Add"))
Rs("Url") = Request.ServerVariables("Url")
If isVerify = 0 Then
Rs("ItemRec") = 1
Else
Rs("ItemRec") = 0
End If
Rs.Update
for i=1 to 10
next
Rs.Close : Set Rs=Nothing
WriteMsg("发布成功,点击查看!")
Response.Redirect "MemberNote.asp"
Rs.Close:Set Rs=Nothing
'------------------------------------------------
End If
%>
<form name='Gbookform' id='Gbookform' action='?Action=Save' method='post' onSubmit='return CheckGbook();'>
<div class="member_table_data">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>姓名</td><td><input name="UserName" type="text" class="data_input" /></td>
<td>性别</td><td><input name="Sex" type="text" class="data_input_short" /></td>
<td>年龄</td><td><input name="Add" type="text" class="data_input_short" /></td>
<td>电话</td><td><input name="Tel" type="text" class="data_input" /></td>
<td>客户来源</td><td><input name="ItemName" type="text" class="data_input_long" /></td>
<td>购买意向</td><td><input name="body" type="text" class="data_input_long" /></td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>姓名</td><td><input name="UserName" type="text" class="data_input" /></td>
<td>性别</td><td><input name="Sex" type="text" class="data_input_short" /></td>
<td>年龄</td><td><input name="Add" type="text" class="data_input_short" /></td>
<td>电话</td><td><input name="Tel" type="text" class="data_input" /></td>
<td>客户来源</td><td><input name="ItemName" type="text" class="data_input_long" /></td>
<td>购买意向</td><td><input name="body" type="text" class="data_input_long" /></td>
</tr>
</table>
<div class="right">备注:会员上传出现电话号码相同的客户的将不能提交</div>
<div class="center"><input type="submit" class="black_button" value="提 交" /></div>
</div><!-- member_table_porfile -->
</form> 展开
If Action = "Save" Then
Tel = CheckSql(Trim(Request.Form("Tel")))
body = CheckSql(Trim(Request.Form("body")))
'---------------------------
Set Rs = Conn.Execute("Select * From ["&dodeTable&"] where Tel='"&Tel&"'")
If Not Rs.Eof Then ClMsg "不允许重复电话!","MemberNote.asp"
'---------------------------
Set Rs=Server.CreateObject("Adodb.RecordSet")
Rs.Open "Select * From [dode_MemberNote]",Conn,1,3
Rs.AddNew
Rs("MemberID") = Int(Session("MemberID"))
Rs("ItemName") = ItemName
Rs("body") = body
Rs("UserName") = Trim(Request.Form("UserName"))
Rs("ItemName") = Trim(Request.Form("ItemName"))
Rs("Sex") = Trim(Request.Form("Sex"))
Rs("Tel") = Trim(Request.Form("Tel"))
Rs("Add") = Trim(Request.Form("Add"))
Rs("Url") = Request.ServerVariables("Url")
If isVerify = 0 Then
Rs("ItemRec") = 1
Else
Rs("ItemRec") = 0
End If
Rs.Update
for i=1 to 10
next
Rs.Close : Set Rs=Nothing
WriteMsg("发布成功,点击查看!")
Response.Redirect "MemberNote.asp"
Rs.Close:Set Rs=Nothing
'------------------------------------------------
End If
%>
<form name='Gbookform' id='Gbookform' action='?Action=Save' method='post' onSubmit='return CheckGbook();'>
<div class="member_table_data">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>姓名</td><td><input name="UserName" type="text" class="data_input" /></td>
<td>性别</td><td><input name="Sex" type="text" class="data_input_short" /></td>
<td>年龄</td><td><input name="Add" type="text" class="data_input_short" /></td>
<td>电话</td><td><input name="Tel" type="text" class="data_input" /></td>
<td>客户来源</td><td><input name="ItemName" type="text" class="data_input_long" /></td>
<td>购买意向</td><td><input name="body" type="text" class="data_input_long" /></td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>姓名</td><td><input name="UserName" type="text" class="data_input" /></td>
<td>性别</td><td><input name="Sex" type="text" class="data_input_short" /></td>
<td>年龄</td><td><input name="Add" type="text" class="data_input_short" /></td>
<td>电话</td><td><input name="Tel" type="text" class="data_input" /></td>
<td>客户来源</td><td><input name="ItemName" type="text" class="data_input_long" /></td>
<td>购买意向</td><td><input name="body" type="text" class="data_input_long" /></td>
</tr>
</table>
<div class="right">备注:会员上传出现电话号码相同的客户的将不能提交</div>
<div class="center"><input type="submit" class="black_button" value="提 交" /></div>
</div><!-- member_table_porfile -->
</form> 展开
展开全部
看着分多 写点代码算了
'判断是否提交了多个表单,前提是要有JS验证,输入里不能有逗号
if instr(Request.Form("UserName"),",") then
newUserName=split(Request.Form("UserName"),",")
newItemName=split(Request.Form("ItemName"),",")
...... '自己补齐
for i=0 to ubound(newUserName)
conn.Execute("insert into table (username,itemname) values ('"&newUserName(i)&"','"&newItemName(i)&"')")
next
end if
思路差不多就这样了
'判断是否提交了多个表单,前提是要有JS验证,输入里不能有逗号
if instr(Request.Form("UserName"),",") then
newUserName=split(Request.Form("UserName"),",")
newItemName=split(Request.Form("ItemName"),",")
...... '自己补齐
for i=0 to ubound(newUserName)
conn.Execute("insert into table (username,itemname) values ('"&newUserName(i)&"','"&newItemName(i)&"')")
next
end if
思路差不多就这样了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
不太明白你的意思
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询