ole - 2013/8/19 14:16:07
新建模板如下:
<ul class="article">
<%
DataTable dt=Get_Data(string sql);
DataRow dr;
for(int i=0;i<dt.Rows.Count;i++)
{
dr=dt.Rows[i];
%>
<li><span class="title">
<a href="<%=Detail_Url(dr)%>" target="<%=Target%>" title="<%=Server.HtmlEncode(dr["title"].ToString())%>" style="<%=dr["pa_comments"]%>"><%=SubStr(dr["title"].ToString(),Title_Num,true)%></a></span>
<span class="date"><%=((DateTime)dr["thedate"]).ToString("MM-dd")%></span>
</li>
<%
}
%>
</ul>
[b]
出现如下错[/b]
Server Error in '/' Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1513: } expected
Source Error:
Line 9: <%}%><%conn.Open();%><ul class="article">
Line 10: <%
Line 11: DataTable dt=Get_Data(string sql);
Line 12: DataRow dr;
Line 13: for(int i=0;i<dt.Rows.Count;i++)
xiyou - 2013/8/19 15:23:35
DataTable dt=Get_Data(string sql);里面sql语句字符未定义
参考:
http://bbs.pageadmin.net/showtopic-25798.aspx