DSC微信投票翻页

//数据绑定
    public void dlBind(string chatid)
    {
        int curpage = Convert.ToInt32(this.labPage.Text);
        PagedDataSource ps=new PagedDataSource();
        string sql="select id,s.agentname,case when v.votenum is null then 0 when votenum is not null then sum(votenum) end as votenum,case when s.photourl IS NULL then ‘User/UserHeadImage/123.gif‘ else s.photourl end as photourl from staff s left join wxvote v on s.agentname=v.tlname where s.rank in(‘tl‘,‘sup‘) and s.quit is null and s.unit in (select unit from staff where wechatid=‘"+ chatid +"‘) group by id,s.agentname,v.votenum,s.photourl order by id";
        SqlDataAdapter da=new SqlDataAdapter(sql,SqlHelper.mycon);
        DataSet ds=SqlHelper.ExecuteDataset(SqlHelper.mycon,CommandType.Text, sql);
        da.Fill(ds,"vote_table");
        ps.DataSource=ds.Tables["vote_table"].DefaultView;
        ps.AllowPaging=true;
        ps.PageSize=9;
        ps.CurrentPageIndex=curpage-1;
        lnkbtnFst.Enabled = true;
        lnkbtnLast.Enabled = true;
        lnkbtnUp.Enabled = true;
        lnkbtnNext.Enabled = true;
        if(curpage==1)
        {
            this.lnkbtnFst.Enabled=false;
            this.lnkbtnUp.Enabled=false;
        }
        if(curpage==ps.PageCount)
        {
            this.lnkbtnNext.Enabled=false;
            this.lnkbtnLast.Enabled=false;
        }
        this.labLstPage.Text=Convert.ToString(ps.PageCount);
        this.dlContent.DataSource=ps;
        this.dlContent.DataKeyField="id";
        this.dlContent.DataBind();
    }

DSC微信投票翻页

上一篇:微信公众平台深度开发JAVA版


下一篇:【数据结构与算法】基础排序算法总结与Python实现