C#中DataLIst绑定后数据显示不全
给DataList绑定之后,数据显示不全,好像只显示了一半,即是8条结果只显4条,13条结果只显示7条,这是为什么呢,请高人指点!
绑定的代码如下:
private void BindData()
{
string connstr=System.Configuration.ConfigurationSettings.AppSettings["sql2000"].ToString();
SqlConnection myconnection=new SqlConnection(connstr);
myconnection.Open();
string selectstr="select * from NewPost where postid="+PostID;
SqlDataAdapter da1=new SqlDataAdapter(selectstr,myconnection);
string selstr="select * from newpost where parentid="+PostID;
SqlDataAdapter da2=new SqlDataAdapter(selstr,myconnection);
DataSet ds=new DataSet();
da1.Fill(ds,"host");
da2.Fill(ds,"guest");
LB_Subject.Text=ds.Tables["host"].Rows[0][3].ToString();
int recount=ds.Tables["guest"].Rows.Count;
LB_Replies.Text=recount.ToString();
LB_Time.Text=ds.Tables["host"].Rows[0][4].ToString();
LB_Content.Text=ds.Tables["host"].Rows[0][5].ToString();
LB_Name.Text=ds.Tables["host"].Rows[0][2].ToString();
DL_Reply.DataSource=ds;
DL_Reply.DataMember="guest";
DL_Reply.DataBind();
// this.DataBind();
myconnection.Close();
}
搜索更多相关主题的帖子:
绑定 DataLIst 数据