Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 显示多个ASP项目_Sql_Asp Classic - Fatal编程技术网

Sql 显示多个ASP项目

Sql 显示多个ASP项目,sql,asp-classic,Sql,Asp Classic,我需要显示多个ASP项目。我们有一个后端工具,可以添加多个条目,但只显示前两个条目。我希望有一个小的代码调整,将允许更多的页面显示。显示代码的两个页面的代码如下所示: <% dim sql sql = "select * from announcement_table where ann_status=1" set rs = con.execute(sql) %> <%if not(rs.eof and rs.bof) then%> <p><strong

我需要显示多个ASP项目。我们有一个后端工具,可以添加多个条目,但只显示前两个条目。我希望有一个小的代码调整,将允许更多的页面显示。显示代码的两个页面的代码如下所示:

<%
dim sql
sql = "select * from announcement_table where ann_status=1"
set rs = con.execute(sql)
%>
<%if not(rs.eof and rs.bof) then%>
<p><strong><%=rs("ann_title")%></strong> </p>
<p><%=rs("ann_text")%>
    <%else%>
  Currently there are no announcements.
  <%
end if
rs.close
set rs = nothing
%>
 </p>   
<hr size="1" noshade>
<%
dim sql_, sqlcount
sqlcount = "select count(*) from announcement_table"
set rscount = con.execute(sqlcount) 
sql_ = "select * from announcement_table where ann_status <> 1"
set rs_ = con.execute(sql_)
%>
<%if rscount(0)>1 then%>
<%if not(rs_.eof and rs_.bof) then%>
<a href="announcements_more.asp?ann_id=<%=rs_("ann_id")%>"><%=rs_("ann_title")%></a>         <br>
  <%else%>
  Currently there are no announcements.
    <%
end if
rs_.close
set rs_ = nothing
%>
<%end if
rscount.close
set rscount = nothing
%>

目前没有任何公告。


1那么%>
目前没有任何公告。
这是第二页:

<%
dim sql_
sql_ = "select * from announcement_table where ann_id=" & intann_id
set rs_ = con.execute(sql_)
%>
<p><strong><%=rs_("ann_title")%></strong> </p>
<p><%=rs_("ann_text")%></p>

<%rs_.close
set rs_ = nothing
%>


在第二页中,您需要循环记录集以显示多个值

<%
    dim sql_
    sql_ = "select * from announcement_table where ann_id=" & intann_id
    set rs_ = con.execute(sql_)

    While Not rs_.EOF
    %>
    <p><strong><%=rs_("ann_title")%></strong> </p>
    <p><%=rs_("ann_text")%></p>

    <%
    rs_.Movenext
    Wend
    rs_.close
    set rs_ = nothing
    %>


并检查此链接。

您好,sql注入漏洞。第二页的代码实际上是在乞求被黑客攻击。如果我是唯一一个可以访问该页面的人,该页面会被黑客攻击吗?这是一个只有我才能访问的后端工具,所以我不太担心黑客攻击,除非我出错了,否则它是可以访问的?这个工具已经以这种方式使用了15年,没有任何问题。