0

我在这里收到此页面上的错误,我已经有一段时间没有碰它了。我今天编辑了一个页面模板,然后看到了错误,但我不明白为什么会这样。

这是代码,它是第 56 行:

<!--#include virtual="/System/Startup_Public.asp"-->
<%
'response.write request.querystring

sql = "SELECT *,dbo.RemoveNonAlphaCharacters(cn_title) AS URL FROM CommunityNews WHERE "&_ 
    " cn_live = 1 AND cn_franchise = '{"&session("PublicFranchiseGID")&"}' "&_ 
    "AND DATENAME(month,cn_startdate) = '"&getquery("m")&"' "&_ 
    "AND YEAR(cn_startdate) = "&cint(getquery("y"))&" "&_
    "AND dbo.RemoveNonAlphaCharacters(cn_title) = '"&getquery("a")&"';"
getrs rs,sql,""

if rs.recordcount = 0 then 
    response.write sql
    response.write "Event not found." : response.end
end if

If Session("PublicFranchiseGID") = "" then
    Response.Redirect "/"
End if

    sLink = "/" & lcase(session("publicfranchisename")) & "/news/" & year(rs("cn_startdate")) & "/" & monthname(month(rs("cn_startdate"))) & "/" & lcase(rs("URL")) & ".html"
    if not sLink = request.ServerVariables("HTTP_X_REWRITE_URL") then
        response.status = "301 Moved Permanently"
        response.addheader "Location", "http://www.inside-guides.co.uk" & sLink
        response.end
    end if

EnsurePageIsBasicHTTP

startdate = date()
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><%=server.HTMLEncode(""&rs("cn_title"))%> | <%=server.HTMLEncode(Session("PublicFranchiseName"))%>&nbsp;News, Essex</title>
<meta name="Description" content="<%=server.HTMLEncode(""&rs("cn_title"))%> | <%=server.HTMLEncode(Session("PublicFranchiseName"))%>&nbsp;News, Essex" />
<meta name="Keywords" content="<%=server.HTMLEncode(""&rs("cn_title"))%>, <%=server.HTMLEncode(Session("PublicFranchiseName"))%>, Submit News" />
<link rel="stylesheet" type="text/css" href="/css/hot-sneaks/jquery-ui-1.8.22.custom.css"/>
<!--#include virtual="/Assets/Templates/Public/Franchise/HeadCSS.asp"-->
<link rel="stylesheet" type="text/css" href="/css/NewsDetails.css"/>
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.22.custom.min.js"></script>
<script type="text/javascript">
    $(document).ready(function(e) {
        $('#datepicker').datepicker({
        dateFormat:'dd/mm/yy'
        });
    });
</script>
</head>
<body id="news">
<!--#include virtual="/Assets/Templates/Public/Franchise/News.asp"-->

    <div class="middle-content-grey main-article clearfix">
    <h1 class="event-title"><%=server.HTMLEncode(""&rs("cn_title"))%></h1>
    <% if len(""&rs("cn_fullimage"))>0 then %>
        <img src="/includes/tn.asp?src=/LiveStorage/Uploads/image/CommunityNews/<%=server.URLEncode(""&rs("cn_fullimage"))%>" class="fullimage" />
    <% end if %>
    <div class="event-address"><h3><img class="newsitem" src="/images/map.png" alt="event location" /> Submitted by <%=server.HTMLEncode(rs("cn_location"))%></h3></div>
    <div class="event-date"><h4><img class="newsitem" src="/images/date.png" alt="event date" /> On <%=formatdatetime(rs("cn_startdate"),1)%>
    <% if not rs("cn_startdate") = rs("cn_enddate") then %> - <%=formatdatetime(rs("cn_enddate"),1)%><% end if %></h4></div>

    <div class="article-details"><p><%=rs("cn_article")%></p></div>
    </div>
<br />
    <div id="frmcomment" class="middle-content-grey">
    <h2>Visitor Comments</h2>

    <% getrs com,"SELECT * FROM CommunityNewsComments WHERE nc_article = "&cint(rs("cn_id"))&" AND nc_approved = 1 ORDER BY nc_datetime ASC;",""
    if com.recordcount = 0 then
    %><p class="comment">Be the first to comment</p><%
    else
        while not com.eof
            %>
            <div class="comment">
                <div class="title"><%=formatdatetime(com("nc_datetime"),1)%>&nbsp;at&nbsp;<%=formatdatetime(com("nc_datetime"),3)%> by <%=server.HTMLEncode(""&com("nc_name"))%></div>
                <p><%=server.HTMLEncode(""&com("nc_comment"))%></p>                
            </div>
            <%
        com.movenext : wend
    end if 
    %>
    <h3>Leave a Comment:</h3>
    <form id="form" method="post" action="" 
    onsubmit="
    if ($('#email').val()=='' || $('#name').val()=='' || $('#comment').val()=='') {alert('Please complete all fields');return false}
    $.ajax({
        type:'POST',
        url:'/ajax/newsComment.asp',
        data:$(this).serialize(),
        success: function(data){
            $('#frmcomment').html(data);
        }
    });return false;
    "><input type="hidden" name="news" id="news" value="<%=server.HTMLEncode(""&rs("cn_id"))%>" />
        <label>Email Address<span class="smaller">Required</span></label>
        <input type="text" name="email" id="email" />
        <label>Your Name<span class="smaller">Required</span></label>
        <input type="text" name="name" id="name" />
        <label>Your comment<span class="smaller">Required</span></label>
        <textarea name="comment" id="comment"></textarea>
        <button class="button medium news-green form" type="submit"><span>Leave Comment</span></button><br />
        <textarea name="options" id="options" style="display:none;"></textarea>
    </form>
    </div>

<br />
 <a class="button medium news-green top" href='#top'><span>Top</span></a>
 <a class="button medium news-green home" href="/<%=lcase(Session("PublicFranchiseName"))%>/news/index.html"><span>News</span></a>
<!--#include virtual="/Assets/Templates/Public/Franchise/TemplateEnd.asp"-->
</body>
</html>
<!--#include virtual="/System/Shutdown.asp"-->

任何想法将不胜感激。

4

1 回答 1

1

尝试这个

<!--#include virtual="/System/Startup_Public.asp"-->
<%
'response.write request.querystring

sql = "SELECT *,dbo.RemoveNonAlphaCharacters(cn_title) AS URL FROM CommunityNews WHERE "&_ 
    " cn_live = 1 AND cn_franchise = '{"&session("PublicFranchiseGID")&"}' "&_ 
    "AND DATENAME(month,cn_startdate) = '"&getquery("m")&"' "&_ 
    "AND YEAR(cn_startdate) = "&cint(getquery("y"))&" "&_
    "AND dbo.RemoveNonAlphaCharacters(cn_title) = '"&getquery("a")&"';"
getrs rs,sql,""

if rs.recordcount = 0 then 
    response.write sql
    response.write "Event not found." : response.end
end if

If Session("PublicFranchiseGID") = "" then
    Response.Redirect "/"
End if

If NOT rs.EOF Then
    ' Arrange / retrieve these in the order they're in from your database table
    cn_id = rs("cn_id")
    cn_startdate = rs("cn_startdate")
    URL = rs("URL")
    cn_title = rs("cn_title")
    cn_fullimage = rs("cn_fullimage")
    cn_location = rs("cn_location") 
    cn_enddate = rs("cn_enddate")
    cn_article = rs("cn_article")
End If

    sLink = "/" & lcase(session("publicfranchisename")) & "/news/" & year(cn_startdate) & "/" & monthname(month(cn_startdate)) & "/" & lcase(URL) & ".html"
    if not sLink = request.ServerVariables("HTTP_X_REWRITE_URL") then
        response.status = "301 Moved Permanently"
        response.addheader "Location", "http://www.inside-guides.co.uk" & sLink
        response.end
    end if

EnsurePageIsBasicHTTP

startdate = date()
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><%=server.HTMLEncode(""&cn_title)%> | <%=server.HTMLEncode(Session("PublicFranchiseName"))%>&nbsp;News, Essex</title>
<meta name="Description" content="<%=server.HTMLEncode(""&cn_title)%> | <%=server.HTMLEncode(Session("PublicFranchiseName"))%>&nbsp;News, Essex" />
<meta name="Keywords" content="<%=server.HTMLEncode(""&cn_title)%>, <%=server.HTMLEncode(Session("PublicFranchiseName"))%>, Submit News" />
<link rel="stylesheet" type="text/css" href="/css/hot-sneaks/jquery-ui-1.8.22.custom.css"/>
<!--#include virtual="/Assets/Templates/Public/Franchise/HeadCSS.asp"-->
<link rel="stylesheet" type="text/css" href="/css/NewsDetails.css"/>
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.22.custom.min.js"></script>
<script type="text/javascript">
    $(document).ready(function(e) {
        $('#datepicker').datepicker({
        dateFormat:'dd/mm/yy'
        });
    });
</script>
</head>
<body id="news">
<!--#include virtual="/Assets/Templates/Public/Franchise/News.asp"-->

    <div class="middle-content-grey main-article clearfix">
    <h1 class="event-title"><%=server.HTMLEncode(""&cn_title)%></h1>
    <% if len(""&cn_fullimage)>0 then %>
        <img src="/includes/tn.asp?src=/LiveStorage/Uploads/image/CommunityNews/<%=server.URLEncode(""&cn_fullimage)%>" class="fullimage" />
    <% end if %>
    <div class="event-address"><h3><img class="newsitem" src="/images/map.png" alt="event location" /> Submitted by <%=server.HTMLEncode(cn_location)%></h3></div>
    <div class="event-date"><h4><img class="newsitem" src="/images/date.png" alt="event date" /> On <%=formatdatetime(cn_startdate,1)%>
    <% if not cn_startdate = cn_enddate then %> - <%=formatdatetime(cn_enddate,1)%><% end if %></h4></div>

    <div class="article-details"><p><%=cn_article%></p></div>
    </div>
<br />
    <div id="frmcomment" class="middle-content-grey">
    <h2>Visitor Comments</h2>

    <% getrs com,"SELECT * FROM CommunityNewsComments WHERE nc_article = "&cint(cn_id)&" AND nc_approved = 1 ORDER BY nc_datetime ASC;",""
    if com.recordcount = 0 then
    %><p class="comment">Be the first to comment</p><%
    else
        while not com.eof
            %>
            <div class="comment">
                <div class="title"><%=formatdatetime(com("nc_datetime"),1)%>&nbsp;at&nbsp;<%=formatdatetime(com("nc_datetime"),3)%> by <%=server.HTMLEncode(""&com("nc_name"))%></div>
                <p><%=server.HTMLEncode(""&com("nc_comment"))%></p>                
            </div>
            <%
        com.movenext : wend
    end if 
    %>
    <h3>Leave a Comment:</h3>
    <form id="form" method="post" action="" 
    onsubmit="
    if ($('#email').val()=='' || $('#name').val()=='' || $('#comment').val()=='') {alert('Please complete all fields');return false}
    $.ajax({
        type:'POST',
        url:'/ajax/newsComment.asp',
        data:$(this).serialize(),
        success: function(data){
            $('#frmcomment').html(data);
        }
    });return false;
    "><input type="hidden" name="news" id="news" value="<%=server.HTMLEncode(""&cn_id)%>" />
        <label>Email Address<span class="smaller">Required</span></label>
        <input type="text" name="email" id="email" />
        <label>Your Name<span class="smaller">Required</span></label>
        <input type="text" name="name" id="name" />
        <label>Your comment<span class="smaller">Required</span></label>
        <textarea name="comment" id="comment"></textarea>
        <button class="button medium news-green form" type="submit"><span>Leave Comment</span></button><br />
        <textarea name="options" id="options" style="display:none;"></textarea>
    </form>
    </div>

<br />
 <a class="button medium news-green top" href='#top'><span>Top</span></a>
 <a class="button medium news-green home" href="/<%=lcase(Session("PublicFranchiseName"))%>/news/index.html"><span>News</span></a>
<!--#include virtual="/Assets/Templates/Public/Franchise/TemplateEnd.asp"-->
</body>
</html>
<!--#include virtual="/System/Shutdown.asp"-->

我所做的是将您的一些数据库字段设置为变量。尝试按照在数据库中定义的顺序检索字段。

于 2013-01-11T12:44:43.527 回答