private void Data_Binding() { PagedDataSource pd = new PagedDataSource(); if (ViewState["DataSource"] == null) { //查询已翻译的 //select [key],text,username,translatedText,updateTime from textinfo left join translation on (translation.textId = textinfo.textId) where projectId='201722421213darkestdungeon' and translatedText is not null; //查询所有的 //select [key],text,username,translatedText,updateTime from textinfo left join translation on (translation.textId=textinfo.textId) where projectId='201722421213darkestdungeon'; //查询未翻译的 //select [key],text,username,translatedText,updateTime from textinfo left join translation on (translation.textId=textinfo.textId) where projectId='201722421213darkestdungeon' and translation.textId is null; //string sql = $"select [key],text from textinfo where projectId='{projectId}'"; string sql = $"select[key],textinfo.textId,text,username,translatedText,updateTime from textinfo left join translation on(translation.textId = textinfo.textId) where projectId = '{projectId}'"; ViewState["DataSource"] = SQLHelper.GetDataTable(sql); } pd.DataSource = ((DataTable)ViewState["DataSource"]).DefaultView; pd.AllowPaging = true; pd.PageSize = 20; pd.CurrentPageIndex = CurrentPage; Label1.Text = $"当前:{ (CurrentPage + 1).ToString()}/{ pd.PageCount.ToString()}"; ButtonPrevious.Enabled = !pd.IsFirstPage; ButtonNext.Enabled = !pd.IsLastPage; Repeaterprojects.DataSource = pd; Repeaterprojects.DataBind(); }
private void Data_Binding() { PagedDataSource pd = new PagedDataSource(); if (ViewState["DataSource"] == null) { string sql = "select username from userinfo where rights is null"; ViewState["DataSource"] = SQLHelper.GetDataTable(sql); } pd.DataSource = ((DataTable)ViewState["DataSource"]).DefaultView; pd.AllowPaging = true; pd.PageSize = 10; pd.CurrentPageIndex = CurrentPage; Label1.Text = $"当前:{ (CurrentPage + 1).ToString()}/{ pd.PageCount.ToString()}"; ButtonPrevious.Enabled = !pd.IsFirstPage; ButtonNext.Enabled = !pd.IsLastPage; Repeaterprojects.DataSource = pd; Repeaterprojects.DataBind(); }