日期:2014-05-17  浏览次数:20480 次

Aspnetpager repeater翻页问题
protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

           // userinfo();
            using (OleDbConnection connection = new OleDbConnection(SQLHelper.connectionString))
            {
                string sql = "select count(id) as num from [content]";
                if (connection.State != ConnectionState.Open)
                    connection.Open();
                OleDbCommand cmd = new OleDbCommand(sql, connection);
                object val = new object();
                try
                {
                    aspnetpager.RecordCount =Convert.ToInt32( cmd.ExecuteScalar());
                    
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
                connection.Close();
                Bind();
            }

        }
    }
  private void Bind()
    {
            ds.Clear();
               OleDbConnection connection = new OleDbConnection(SQLHelper.connectionString);
        
            string sqlStr = "select co.[id],co.[title],co.[content],co.publisher,co.readcount,co.simplepicid,co.[time],si.picaddress,si.type from [content] co,simplepic si where co.simplepicid=si.id order by co.id desc";
            if (connection.State != ConnectionState.Open)
       &