留言本回复的

libaisongtuye 2004-12-09 04:25:03
我在做留言本的时候,想要到回复表里查询是否已经回复
高手给看看,为什么在显示信息的时候,要不只显示已经回复的,没回复的没有“回复”按钮,要不就是已经回复的没有反应在,没回的有个“回复”按钮,这倒底是怎么回事,看着有点晕呢!
<%
set rs1=server.CreateObject("adodb.recordset")
sql1="select shi from huifu where dingid="&rs("id")
rs1.open sql1,cn,1,1
if not rs1.eof then
if rs1("shi")=true then
response.Write("已经回复")
else
%>
<input name="hui" type="button" onClick=" window.open('hui_ding_hui.asp?id=<%= rs("id") %>','_self');" value="回复"></td>
<%
end if
end if
set rs1=nothing
%>
...全文
124 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
libaisongtuye 2004-12-10
  • 打赏
  • 举报
回复
<%
set rs1=cn.execute("select shi from huifu where dingid="&rs("id")&" and shi=true")
if not rs1.eof then
response.Write("已经回复")
else
%>
<input name="hui" type="button" onClick=" window.open('hui_ding_hui.asp?id=<%= rs("id") %>','_self');" value="回复"></td>
<%
end if
set rs1=nothing
%>
我改成这样好使了!
comszsoft 2004-12-10
  • 打赏
  • 举报
回复
<%
set rs1=server.CreateObject("adodb.recordset")
sql1="select shi from huifu where dingid="&rs("id")
rs1.open sql1,cn,1,1
while not rs.eof //add this
if not rs1.eof then
if rs1("shi")=true then
response.Write("已经回复")
else
%>
<input name="hui" type="button" onClick="window.open('hui_ding_hui.asp?id=<%= rs("id") %>','_self');" value="回复"></td>
<%
end if
end if
rs1.movenext //add this
wend //add this
set rs1=nothing
%>
试试看
libaisongtuye 2004-12-10
  • 打赏
  • 举报
回复
rs1("shi")字段在我建表的时候设为"是/否"类型,这个我在存进去的时候是不是可以写成
rs1("shi")=true,然后读的时候也可以根据true/false还判断??
comstep 2004-12-09
  • 打赏
  • 举报
回复
那说明rs1("shi")<>true 啊!
检查一下该字段的属性,
到底是 是/否,真/假 开/关?(access)
libaisongtuye 2004-12-09
  • 打赏
  • 举报
回复
上面的代码,我用了,可是没有什么效果,还是老样子,只显“示已经回复” 没回复的,需要点击的回复的按钮不显示,不知道是怎么回事??
libaisongtuye 2004-12-09
  • 打赏
  • 举报
回复
顶起,高手帮看下!
dafeifei 2004-12-09
  • 打赏
  • 举报
回复
应该没什么问题,数据库查询类型比较容易作怪,强行转换一下试试

<%
set rs1=server.CreateObject("adodb.recordset")
sql1="select shi from huifu where dingid="&cstr(rs("id")) 'id这个字段为bigint型
rs1.open sql1,cn,1,1
if not rs1.eof then
if rs1("shi") then 'shi这个字段为bit型
response.Write("已经回复")
else
%>
<input name="hui" type="button" onClick=" window.open('hui_ding_hui.asp?id=<%= rs("id") %>','_self');" value="回复"></td>
<%
end if
end if
set rs1=nothing
%>

28,409

社区成员

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

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