Posted by 半神 on 2008-12-09 12:13 上午
|
首先在C#代码中: SqlConnection conPubs; SqlCommand cmdSelect; SqlDataReader dtrAuthors; conPubs = new SqlConnection("server=localhost;uid=sa;pwd=123; database=yokbase"); cmdSelect = new SqlCommand("Select * from yok_ArticleComment", conPubs); conPubs.Open(); dtrAuthors = cmdSelect.ExecuteReader(); Repeater1.DataSource=dtrAuthors; Repeater1.DataBind(); dtrAuthors.Close(); conPubs.Close(); 然后在设计页面中添加相应的模板:
<%#DataBinder.Eval(Container.DataItem,"UserCode","Conment_Add_Time")%> | <%#DataBinder.Eval(Container.DataItem,"Comment_Content")%> | | <%#DataBinder.Eval(Container.DataItem,"UserCode","Conment_Add_Time")%> | <%#DataBinder.Eval(Container.DataItem,"Comment_Content")%> | <%#DataBinder.Eval(Container.DataItem,"UserCode","Conment_Add_Time")%> | <%#DataBinder.Eval(Container.DataItem,"Comment_Content")%> | <%#DataBinder.Eval(Container.DataItem,"UserCode","Conment_Add_Time")%> | <%#DataBinder.Eval(Container.DataItem,"Comment_Content")%> |
|