日期:2014-05-16 浏览次数:21054 次
<!--#include file="ccc.asp" -->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
ap="135123111xx,13699885xx,1366666xx,15955xxxxx"
sd=split(ap,",")
for i=0 to ubound(sd)-1
set rs=server.createobject("adodb.recordset")
rs.Open sql,conn,1,1
if rs.EOF or rs.bof then
set rs=conn.execute("insert into a (c) values ('"&sd(i)&"')")
rs.Open sql,conn,1,3
response.write "<script language=JavaScript>" & chr(13) & "alert('此信息录入成功!');"&"window.location.href = 'a.asp?part="& request("part")&"&yh="& request("yh")&"' </script>"
set rs=nothing
else
response.write "<script language=JavaScript>" & chr(13) & "alert('此信息已经添加!');" & "history.back()" & "</script>"
end if
rs.Close
set rs=nothing
set conn=nothing
%>
ap="135123111xx,13699885xx,1366666xx,15955xxxxx"
sd=split(ap,",")
for i=0 to ubound(sd)'改这样,要不最后一个没有插入
set rs=server.createobject("adodb.recordset")
'这里sql没见你定义,不知道你包含文件ccc.asp中是否有定义,没有就出错了
'猜测你是需要构造sql语句判断内容是否存在是吧。。。
sql="select count(*) from a where c='"&sd(i)&"'"'''''''''''''''
rs.Open sql,conn,1,1
if rs.EOF or rs.bof then
set rs=conn.execute("insert into a (c) values ('"&sd(i)&"')")
' rs.Open sql,conn,1,3'你这里又打开游标干嘛??
response.write "<script language=JavaScript>" & chr(13) & "alert('此信息录入成功!');"&"window.location.href = 'a.asp?part="& request("part")&"&yh="& request("yh")&"' </script>"
set rs=nothing
else
response.write "<script language=JavaScript>" & chr(13) & "alert('此信息已经添加!');" & "history.back()" & "</script>"
end if
rs.Close
next'''''''''''''''''''for循环没结束
set rs=nothing
set conn=nothing