请各位高手、大侠帮忙

cscfzk 2012-12-16 06:26:10
数据库sbg1 表名sbdj 字段1是lcxh 字段2是cl
想请各位大侠帮忙的是:如录入数据进字段1,先查询字段1中有无相同数据,如没有相同数据,则允许数据录入,如有相同则查询是否满足字段2中true,如果满足则允许数据录入,如果不满足则显示“事情还没有做完”.请帮忙写一下ASP代码,十分感谢!!
...全文
145 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
cscfzk 2012-12-18
  • 打赏
  • 举报
回复
sdjnliu73 2012-12-17
  • 打赏
  • 举报
回复
上面的还有错误 AAA="查询内容" BBB="录入内容" set rs=conn.execute("select * from sbdj where lcxh='"&AAA&"'") '查询lcxh表 if rs.eof then conn.execute("insert into sbdj (lcxh) values('"&BBB&"')") '录入 Else set rs=conn.execute("select * from sbdj where cl='"&AAA&"'") '查询cl表 if not rs.eof then conn.execute("insert into sbdj (lcxh) values('"&BBB&"')") '录入到哪?不明白 Else rsponse.write "事情还没有做完" End If End If
sdjnliu73 2012-12-17
  • 打赏
  • 举报
回复
上面的有错误 AAA="查询内容" set rs=conn.execute("select * from sbdj where lcxh='"&AAA&"'")'查询lcxh表 if rs.eof then set rs=conn.execute("select * from sbdj where lcxh='"&录入内容&"'") Else set rs=conn.execute("select * from sbdj where cl='"&AAA&"'")'查询cl表 if not rs.eof then set rs=conn.execute("select * from sbdj where lcxh='"&录入内容&"'")'录入到哪?不明白 Else rsponse.write "事情还没有做完" End If End If
sdjnliu73 2012-12-17
  • 打赏
  • 举报
回复
AAA="查询内容" set rs=conn.execute("select * from sbdj where lcxh='"&AAA&"'")'查询lcxh表 if not rs.eof then set rs=conn.execute("select * from sbdj where lcxh='"&录入内容&"'") Else set rs=conn.execute("select * from sbdj where cl='"&AAA&"'")'查询cl表 if not rs.eof then set rs=conn.execute("select * from sbdj where lcxh='"&录入内容&"'")'录入到哪?不明白 Else rsponse.write "事情还没有做完" End If End If
cscfzk 2012-12-17
  • 打赏
  • 举报
回复
如果没有是允许通过,就允许A录入到lcxh,如果有相同的,就查询原与A相同数据相对应的CL,如果原与A相同数据相对应的CL值是未办好就返回主页,如果CL值是已办好就允许A录入到lcxh
-晴天 2012-12-17
  • 打赏
  • 举报
回复
你这儿有个逻辑问题: 查询表,看有没有与A相同的数据,如果没有,则进一步检查 cl 字段 问题来了,既然没有查到相同的数据,你到哪儿去查 cl 字段? 另外,cl字段的值在什么情况下为已办好,或许,里面有很多"已办好",你准备在哪一条记录为已办好时作通过结论呢?
cscfzk 2012-12-17
  • 打赏
  • 举报
回复
数据库sbg1 表名sbdj 字段1是lcxh 字段2是cl 我可能没说清楚:如我现在要录入一个数据若干数据其中有个数据为A,填写后要求这个程序先查询“lcxh”字段中有没有与A相同的数据,如果没有则通过,如果有则查询"cl"字段,“cl”是个选择字段,只有“已办好”“未办好”两个选择,如“cl”中是选择了“已办好”就通过,否则,显示“前事情还没有办好”。另我找到一段代码,:<% lxdh=replace(replace(replace(replace(replace(request("lxdh"),"'",""),"<","("),">",")"),">",")"),"<","(") set rslxdh=server.createobject("adodb.recordset") sqllxdh = "select * from sbdj where lxdh='"&lxdh&"' " rslxdh.open sqllxdh,conn,1,1 if rslxdh.eof=false and request("cl")="0" then response.write "<SCRIPT LANGUAGE=JavaScript>{window.alert('提示:本案前强措还未报法监支队办结!');window.location.href='index.asp'}</script>" response.end end if %> 但在运行中好像没有对“cl”进行判断,请各路高手帮忙修改,谢谢!
cscfzk 2012-12-16
  • 打赏
  • 举报
回复
我试了不行罗,请帮忙!!
cscfzk 2012-12-16
  • 打赏
  • 举报
回复
谢谢大侠我试试
lzp4881 2012-12-16
  • 打赏
  • 举报
回复
<% ... lcxh=request.form("lcxh") set rs=conn.execute("selct * from sbdj") if not rs.eof then if rs("cl")=true then conn.execute("insert into sbdj lcxh values ('"&lcxh&"')") else rsponse.write "事情还没有做完" end if else conn.execute("insert into sbdj lcxh values ('"&lcxh&"')") end if rs.close ... %>

28,391

社区成员

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

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