求教ASP插入数据库如某字段相同提示有重复如何写?
<%Conn.Execute("INSERTINTObiao(title,tentent,ip,tel)Values('"&title&"','"&tentent&"',...
<%
Conn.Execute("INSERT INTO biao(title,tentent,ip,tel) Values('" &title& "','" &tentent& "','" &ip& "','" &tel& "')")
rs.close
set conn=nothing
response.redirect"index.asp?action=logo"
Response.End
%>
如提交的tel数据和数据库有重复就提示信息 展开
Conn.Execute("INSERT INTO biao(title,tentent,ip,tel) Values('" &title& "','" &tentent& "','" &ip& "','" &tel& "')")
rs.close
set conn=nothing
response.redirect"index.asp?action=logo"
Response.End
%>
如提交的tel数据和数据库有重复就提示信息 展开
展开全部
If conn.Execute("Select tel From biao Where tel='"&tel&"'").Eof
Conn.Execute("INSERT INTO biao(title,tentent,ip,tel) Values('" &title& "','" &tentent& "','" &ip& "','" &tel& "')")
rs.close
set conn=nothing
response.redirect"index.asp?action=logo"
Response.End
Else
Response.Write("电话号码重复")
End If
Conn.Execute("INSERT INTO biao(title,tentent,ip,tel) Values('" &title& "','" &tentent& "','" &ip& "','" &tel& "')")
rs.close
set conn=nothing
response.redirect"index.asp?action=logo"
Response.End
Else
Response.Write("电话号码重复")
End If
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询