刚开始学asp.net,请帮忙!
我想把下面的代码写成函数,可以调用
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: CS1513: 应输入 }
源错误:
行 218: this.WriteUTF8ResourceString(__output, 0, 375, false);
行 219: this.WriteUTF8ResourceString(__output, 375, 4221, false);
行 220: this.WriteUTF8ResourceString(__output, 4596, 657, false);
行 221:
行 222: #line 36 "E:\changsanjiao\news\Changsanjiao.aspx"
<%
ShowSubject(string types,int newsid)
{
SqlDataAdapter myCommand = new SqlDataAdapter("select top 10 id,subject from changnews where newsid='"+newsid+"'order by id desc", myConnection);
DataSet ds = new DataSet();
myCommand.Fill(ds, "cnnews");
MyRepeater.DataSource = ds.Tables["cnnews"].DefaultView;
MyRepeater.DataBind();
%>
<ASP:Repeater id="MyRepeater" runat="server">
<HeaderTemplate>
<table width="100%" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="25" bgcolor="#FFC20E" colspan="2"> <strong><font color="#004684"><%=Response.Write(types);%></font></strong></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr >
<td align="center"><img src="/images/point.gif" width="4" height="5"></td>
<td height="22"><%# DataBinder.Eval(Container.DataItem, "subject") %></td>
</tr>
</ItemTemplate><FooterTemplate>
</table>
</FooterTemplate>
</ASP:Repeater>
<%
}
%>