为了账号安全,请及时绑定邮箱和手机立即绑定

请问想做一个报表的添加功能,在添加的时候需要查询报表的编号是否重复?如何实现?

请问想做一个报表的添加功能,在添加的时候需要查询报表的编号是否重复?如何实现?

红糖糍粑 2022-04-08 11:07:22
我想做一个报表的添加功能,在添加的时候需要查询报表的编号是否重复,如果重复就不执行添加,弹出提示窗口,我的程序如下:dim biaohao1biaohao1=trim(request("biaohao"))//biaohao是文本框的nameset rs=server.createobject("adodb.recordset")sql="select * from yuanliao_in_store"rs.open sql,conn,1,3我想在这个地方添加一个FOR语句,可是就是不成功,语句如下for i=1 to rs.recordcountif rs.eof then exit forif(biaohao1=(response.write(rs("biaohao"))){alert("编号重复!");return (false);}nextrs.close希望高手速度解围,小弟谢谢了!急。rs.addnewrs("chushengdi") = trim(request.Form("chushengdi"))rs("jiesheng") = trim(request.Form("jiesheng"))rs("bianhao") = trim(request.Form("bianhao1"))rs("jigou") = trim(request.Form("jigou"))rs("uptime") = request.Form("uptime")rs("jingbanren") = jingbanrenrs("jieshengyuan") = trim(request.Form("jieshengyuan"))rs("content") = trim(request.Form("content"))rs.updateresponse.Write "<script language=javascript>alert('录入成功!');</script>"response.write "<meta http-equiv=""refresh"" content=""0;url=yuanliao_in_store.asp"">"response.endrs.closeset rs=nothingend sub
查看完整描述

1 回答

?
跃然一笑

TA贡献1826条经验 获得超6个赞

sql="select * from yuanliao_in_store"
rs.open sql,conn,1,3
我想在这个地方添加一个FOR语句,可是就是不成功,语句如下
for i=1 to rs.recordcount
if rs.eof then exit for
if(biaohao1=(response.write(rs("biaohao")))
{
alert("编号重复!");
return (false);
}
next

这里改成这样 :

sql="select * from yuanliao_in_store where biaohao="&biaohao1
rs.open sql,conn,1,3
if not rs.eof then
rs.close
response.Write "<script language=javascript>alert('编号重复');</script>"
else

rs.addnew

rs("chushengdi") = trim(request.Form("chushengdi"))
rs("jiesheng") = trim(request.Form("jiesheng"))
rs("bianhao") = trim(request.Form("bianhao1"))
rs("jigou") = trim(request.Form("jigou"))
rs("uptime") = request.Form("uptime")
rs("jingbanren") = jingbanren
rs("jieshengyuan") = trim(request.Form("jieshengyuan"))

rs("content") = trim(request.Form("content"))
rs.update
response.Write "<script language=javascript>alert('录入成功!');</script>"
rs.close
set rs=nothing
response.end
response.write "<meta http-equiv=""refresh"" content=""0;url=yuanliao_in_store.asp"">"
end if
end sub


查看完整回答
反对 回复 2022-04-11
  • 1 回答
  • 0 关注
  • 154 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信