int curPage = Convert.ToInt32( this.Label2.Text); SqlConnection conn = DB.createConn(); conn.Open(); SqlCommand cmd = new SqlCommand("select * from newsKinds",conn); SqlDataReader read = cmd.ExecuteReader(); PagedDataSource ps = new PagedDataSource(); DataTable dt=new DataTable();//创建一个表 dt.Load(read);//datareader 填充表 dt ps.DataSource = dt.DefaultView;//这里一定要用表视图 dt[0].defaultView ps.AllowPaging = true; ps.PageSize = 3; ps.CurrentPageIndex = curPage - 1; this.Button1.Enabled = true; this.Button2.Enabled = true; if(curPage == 1){ this.Button1.Enabled = false; } if (curPage == ps.PageCount) { this.Button2.Enabled = false; } this.Repeater1.DataSource = ps; this.Repeater1.DataBind();