zoukankan      html  css  js  c++  java
  • 内存分页

    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.SqlClient;
    using System.Linq;
    using System.Net;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    public partial class userinfo : System.Web.UI.Page
    {
        public string UsersIp = Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault<IPAddress>(a => a.AddressFamily.ToString().Equals("InterNetwork")).ToString();
        public DateTime UsersTime = DateTime.Now;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }
    
        protected void Button1_Click(object sender, EventArgs e)
        {
            BindData();
        }
    
        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            BindData();
        }
        private void BindData()
        {
            string sql = "select * from Users where 1 = 1 ";
            if (TextBox1.Text.Trim().Length > 0)
            {
                sql += "and UserName ='" + TextBox1.Text.Trim() + "'";
            }
            DataTable dt = SqlHelp.ExecuteDataTable(sql, null);//读取数据 内存数据表中
            AspNetPager1.RecordCount = dt.Rows.Count; //分页控件总记录数等于数据总记录数
    
            PagedDataSource psd = new PagedDataSource(); //数据绑定对象
            psd.DataSource = dt.DefaultView;//数据源=默认视图
            psd.AllowPaging = true;  //数据绑定启用
            psd.PageSize = AspNetPager1.PageSize;//要显示的数目
            psd.CurrentPageIndex = this.AspNetPager1.CurrentPageIndex - 1;//当前页的索引
    
            rep1.DataSource = psd; //绑定数据源
            rep1.DataBind();
        }
    }
  • 相关阅读:
    第一课基础知识
    Linux基础命令
    IO&Process基础知识
    caffe-windows 运行matlab 接口的例子
    process 3d image using caffe
    caffe-windows配置 cuda6.5+vs2012
    cuda7.0安装windows+vs2012
    SGD步长
    Exercise: Convolutional Neural NetworkCNN的反向求导及练习
    Create sparse matrix:sparse
  • 原文地址:https://www.cnblogs.com/enych/p/7832883.html
Copyright © 2011-2022 走看看