求助sql语句

chaiuong 2004-11-24 02:53:35
<%
set rs=server.createobject("adodb.recordset")
sql="select * from hys where hys='一会'"
rs.open sql,db,1,1
%>

<tr class="hy">
<td >一会</td>
<td width="30" align="right" class="pt9">
<%rs.open "select * from hys where startime='8'" ,conn,1,1%> (报错)

<% if not rs.eof then%>
<a href="yd.asp>预订</a>
<%else%>
<a href="yd1.asp>已订</a>
<%end if%>
</td>

</tr>

我要让开始时间startime=8,sql语句应该在哪加
...全文
109 17 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
chaiuong 2004-11-24
  • 打赏
  • 举报
回复
谢谢

虽然还是有点晕
docama 2004-11-24
  • 打赏
  • 举报
回复
有点不太明白你的意思~~~~
但是,同一个表里,你查出来了一次为什么还要再查一次呢?
<%
set rs=server.createobject("adodb.recordset")
sql="select * from hys where hys='一会'"
rs.open sql,db,1,1
if not rs.eof then
%>

<tr class="hy">
<td >一会</td>
<td width="30" align="right" class="pt9">
<% if rs("starttime")=8 then %>
<a href="yd.asp>预订</a>
<%else%>
<a href="yd1.asp>已订</a>
<%end if%>
</td>
</tr>
<%
end if
rs.close
set rs=nothing
%>
chaiuong 2004-11-24
  • 打赏
  • 举报
回复


但是
这句 <%rs.open "select id,startime from hys where startime<>'8'" ,db,1,1%>
无论=8还是<>8怎么出来的结果都一样,全是预订

http://www.sevenstar-hc.com/hys/bb.asp

真搞不清楚了
515189 2004-11-24
  • 打赏
  • 举报
回复
正规的项目是不允许在sql语句里带*号的!
515189 2004-11-24
  • 打赏
  • 举报
回复
影响速度并且容易出错!
chaiuong 2004-11-24
  • 打赏
  • 举报
回复
ding
chaiuong 2004-11-24
  • 打赏
  • 举报
回复
实例:
http://www.sevenstar-hc.com/hys/bb.asp
chaiuong 2004-11-24
  • 打赏
  • 举报
回复
为什么,防注入还是影响速度
515189 2004-11-24
  • 打赏
  • 举报
回复
建议你在你的sql语句中不要带有*号!
chaiuong 2004-11-24
  • 打赏
  • 举报
回复
实例:
http://www.sevenstar-hc.com/hys/bb.asp
chaiuong 2004-11-24
  • 打赏
  • 举报
回复
我要的效果是
select * from hys where startime='8'

<a href="yd.asp>预订</a>
<%else%>
<a href="yd1.asp">已订</a>

郁闷

startime=11的时候出来的是已订,怎么会这样呢
蒋健华 2004-11-24
  • 打赏
  • 举报
回复
那不是你要的效果吗?
chaiuong 2004-11-24
  • 打赏
  • 举报
回复
为什么startime=8的时候出来的是"已订"

ID hys startime endtime info_time bm
1 一会 8 10 2002-10-10 公司办公室
蒋健华 2004-11-24
  • 打赏
  • 举报
回复
rs.open "select * from hys where startime=8'" ,conn,1,1
alern_zyb 2004-11-24
  • 打赏
  • 举报
回复
<%
set rs=server.createobject("adodb.recordset")
sql="select * from hys where hys='一会'"
rs.open sql,db,1,1
%>

<tr class="hy">
<td >一会</td>
<td width="30" align="right" class="pt9">
<%rs2.open "select * from hys where startime='8'" ,conn,1,1%> (报错)

<% if not rs.eof then%>
<a href="yd.asp>预订</a>
<%else%>
<a href="yd1.asp>已订</a>
<%end if%>
</td>

</tr>
chaiuong 2004-11-24
  • 打赏
  • 举报
回复
我这么做的
<%
set rs=server.createobject("adodb.recordset")
sql="select * from hys where hys='一会'"
%>

<tr class="hy">
<td >一会</td>


<td width="30" align="right" class="pt9">
<%rs.open "select * from hys where startime='8'" ,db,1,1%>
<% if not rs.eof then%>
<a href="yd.asp>预订</a>
<%else%>
<a href="yd1.asp">已订</a>
<%end if
rs.close%>
</td>
</tr>

没报错,但输出的页面不对
rainxiang 2004-11-24
  • 打赏
  • 举报
回复
rs.open sql,db,1,1
----->这里打开rs 后没关闭。后面又打开rs自然会错

28,409

社区成员

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

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