资讯   |   开发   |   选机中心   |   产品大全 | IBM | 惠普 | 联想 | 戴尔 | 苹果 | 神舟
更多: | 华硕 | 明基 | 方正 | 紫光 | TCL | 夏新 | 联宝 | 宏碁 | 七喜 | 长城 | 清华同方 | 海尔 | 三星 | 东芝 | 索尼 | 富士通 | LG | 技术 | ddnoon
当前位置:笔记本 > 软件开发 >
Advertisement
文章正文

这是我的 repeater 分页的代码,但是运行起来总是报错.请高手帮忙解决

类型:转载   责任编辑:asp.net   日期:2007/05/23


热门软件下载:


   

System.Data.SqlClient.SqlConnection   connect   =new   System.Data.SqlClient.SqlConnection();  
  string   con   =   System.Configuration.ConfigurationSettings.AppSettings.Get(0);  
   
  private   void   Page_Load(object   sender,   System.EventArgs   e)  
  {  
  string   com   ="Select   *   From   list   Order   By   [time]   DESC";  
  this.connect.ConnectionString=this.con;  
  this.connect.Open();  
  this.sa=new   System.Data.SqlClient.SqlDataAdapter(com,this.connect);  
  this.ds.Clear();  
  this.sa.Fill(ds,"table");  
  this.Repeater1.DataSource=this.ds.Tables["table"];  
  this.Repeater1.DataBind();  
  PagedDataSource   objPds   =   new   PagedDataSource();  
  objPds.DataSource   =   ds.Tables[0].DefaultView;  
  objPds.AllowPaging   =   true;  
  objPds.PageSize   =   5;  
  int   CurPage;  
  if   (Request.QueryString["Page"]   !=   null)  
  CurPage=Convert.ToInt32(Request.QueryString["Page"]);  
  else  
  CurPage=1;  
  objPds.CurrentPageIndex   =   CurPage-1;  
  lblCurrentPage.Text   =   "当前页:"   +   CurPage.ToString();  
   
  if   (!objPds.IsFirstPage)  
  lnkPrev.NavigateUrl=Request.CurrentExecutionFilePath   +   "?Page="   +   Convert.ToString(CurPage-1);  
   
  if   (!objPds.IsLastPage)  
  lnkNext.NavigateUrl=Request.CurrentExecutionFilePath+   "?Page="   +   Convert.ToString(CurPage+1);  
   
  Repeater1.DataSource=objPds;  
  Repeater1.DataBind();  
   
  this.connect.Close();  
         
   
  }  
 

网友回答:


 

 
热门推荐笔记本: 华硕笔记本
相关文章:
笔记本相关:
IT技术文章:
webmaster:popbb@126.com   最佳浏览:1024X768 MSIE
©2007 popbb.net All Rights Reserved