菜鸟问题,很急,谢谢大家!

sea76 2004-01-07 03:59:40
table中有字段code,内容全是手机号码。
我想在程序的文本框中输入一个手机号码,提交到table中。如果和code下已有的号码有相同的,会弹出提示号码已存在,如果没有相同的,什么提示也没有。这段代码怎么写?谢谢
...全文
36 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
xxu333 2004-01-07
  • 打赏
  • 举报
回复
<%
set rs=oconn.execute("select * from table where code='" & request("code") & "'")
if not rs.eof then
response.write "<script>alert('号码已存在');history.go(-1)</script>"
end if
%>
jfly301 2004-01-07
  • 打赏
  • 举报
回复
楼上的思路都差不多,应该是这样
shleo 2004-01-07
  • 打赏
  • 举报
回复
这么多了
…………
swich 2004-01-07
  • 打赏
  • 举报
回复
<%
set rs=conn.execute("select * from table where code='" & request("code") & "'")
if not rs.eof then
response.write "<script>已存在</script>"
end if
%>
ygghost 2004-01-07
  • 打赏
  • 举报
回复
<%
code=request.form("code")
set rs=server.createobject("adodb.recordset")
sql="select * from table where code='"&code&"'"
rs.Open sql,application("cn"),3,1
if not rs.eof then
response.write "<script language=JavaScript>{window.alert('号码存在');window.location.href='*.asp';}</script>"
response.end
end if
%>
xieyj 2004-01-07
  • 打赏
  • 举报
回复
Dim rs
Set rs = Server.CreateObject("Adodb.RecordSet")
rs.open "select code from table where code='"&request("code")&"'",conn,1,3
If Not rs.eof Then
response.write "已经存在!"
End If
rs.close
Set rs = nothing
say1no2 2004-01-07
  • 打赏
  • 举报
回复
提交到数据库之前,做一个查询,看看数据库中有没有重复的号码!

set rs=conn.execute("select * from tablename where code='"&code&"'")
if not rs.eof then
response.write "号码已存在"
end if
xiantao123 2004-01-07
  • 打赏
  • 举报
回复
思路应该是楼上的。
say1no2 2004-01-07
  • 打赏
  • 举报
回复
提交到数据库之前,做一个查询,看看数据库中有没有重复的号码!

set rs=conn.execute("select * from tablename where code='"&code&"'")
if not rs.eof then
response.write "号码已存在"
end if
lbd8848 2004-01-07
  • 打赏
  • 举报
回复
<%
set rs=oconn.execute("select * from table where code='" & request("code") & "'")
if not rs.eof then
response.write "<script>号码已存在</script>"
end if
%>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧