asp 添加数据不重复?下面这句代码哪个帮我改下?
ifurl<>""thendimdomaindomain=mid(url,8)ifinstr(domain,"/")>0thendomain=left(domain,in...
if url<>"" then
dim domain
domain = mid(url,8)
if instr(domain,"/")>0 then
domain = left(domain,instr(domain,"/"))
end if
set rs=server.createobject("adodb.recordset")
sql="select * from detail where url like '%"&domain&"%'"
rs.open sql,conn,1,1
if not(rs.eof or rs.bof) then
Response.Write ("<script language=javascript>alert('抱歉,此域名已经存在!');this.location.href='XYURLCOM_DETAIL_ADD.ASP';</script>")
response.end
rs.close
set rs=nothing
end if
end if
上面这代码,添加数据时,url字段值 只要添加类似的值 就不可以添加?
谁帮我改下。url字段值 不重复的 都可以添加!! 展开
dim domain
domain = mid(url,8)
if instr(domain,"/")>0 then
domain = left(domain,instr(domain,"/"))
end if
set rs=server.createobject("adodb.recordset")
sql="select * from detail where url like '%"&domain&"%'"
rs.open sql,conn,1,1
if not(rs.eof or rs.bof) then
Response.Write ("<script language=javascript>alert('抱歉,此域名已经存在!');this.location.href='XYURLCOM_DETAIL_ADD.ASP';</script>")
response.end
rs.close
set rs=nothing
end if
end if
上面这代码,添加数据时,url字段值 只要添加类似的值 就不可以添加?
谁帮我改下。url字段值 不重复的 都可以添加!! 展开
展开全部
if url<>"" then
set rs=server.createobject("adodb.recordset")
sql="select * from detail where url='"&url&"'"
rs.open sql,conn,1,1
if not(rs.eof or rs.bof) then
Response.Write ("<script language=javascript>alert('抱歉,此URL已经存在!');this.location.href='XYURLCOM_DETAIL_ADD.ASP';</script>")
response.end
rs.close
set rs=nothing
end if
end if
set rs=server.createobject("adodb.recordset")
sql="select * from detail where url='"&url&"'"
rs.open sql,conn,1,1
if not(rs.eof or rs.bof) then
Response.Write ("<script language=javascript>alert('抱歉,此URL已经存在!');this.location.href='XYURLCOM_DETAIL_ADD.ASP';</script>")
response.end
rs.close
set rs=nothing
end if
end if
展开全部
if url<>"" then
dim domain
domain = mid(url,8)
if instr(domain,"/")>0 then
domain = left(domain,instr(domain,"/"))
end if
set rs=server.createobject("adodb.recordset")
sql="select * from detail where url like '%"&domain&"%'"
rs.open sql,conn,1,1
if not(rs.eof or rs.bof) then
Response.Write ("<script language=javascript>alert('抱歉,此域名已经存在!');this.location.href='XYURLCOM_DETAIL_ADD.ASP';</script>")
response.end
else
写上update语句添加进数据库
end if
rs.close
set rs=nothing
end if
dim domain
domain = mid(url,8)
if instr(domain,"/")>0 then
domain = left(domain,instr(domain,"/"))
end if
set rs=server.createobject("adodb.recordset")
sql="select * from detail where url like '%"&domain&"%'"
rs.open sql,conn,1,1
if not(rs.eof or rs.bof) then
Response.Write ("<script language=javascript>alert('抱歉,此域名已经存在!');this.location.href='XYURLCOM_DETAIL_ADD.ASP';</script>")
response.end
else
写上update语句添加进数据库
end if
rs.close
set rs=nothing
end if
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询