zoukankan      html  css  js  c++  java
  • Sql 分页

    string fids = "";
                for (int i = 0; i < fieldIDs.Length; i++)
                {
                    if (!fieldIDs[i].Equals("")) { fids += "," + fieldIDs[i]; }
                }
                fids = (fids.Length > 1 ? fids.Substring(1) : "*");

    string cmdText = @"SELECT ROW_NUMBER() OVER(ORDER BY UPLOADDT DESC) AS ROW_INDEX,
                                       " + fids + " FROM SURVEYINFO(NOLOCK)  WHERE 1=1";
                if (!string.IsNullOrEmpty(where_clause) && where_clause != "")
                {
                    cmdText += " and " + where_clause;
                }
                if (!string.IsNullOrEmpty(orderby_clause) && orderby_clause != "")
                {
                    cmdText += " " + orderby_clause;
                }
               
                int iStartPage = (iPageIndex * iPageSize) + 1;
                int iEndPage = (iPageIndex * iPageSize) + iPageSize;
                cmdText = string.Format(@"SELECT * FROM ({0}) T
                                    WHERE T.ROW_INDEX BETWEEN {1} AND {2}", cmdText, iStartPage, iEndPage);

    return SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, cmdText).Tables[0];

  • 相关阅读:
    ecstore中kvstore之mongodb
    ecstore中kvstore之memcached
    ecostore搜索注意事项
    ecos的dbschema
    ecos的model
    ecos的mvcl
    ecos的app处理类
    ecos的app生命周期
    Linux系统的时间设置
    数的机器码表示——彻底弄清什么是原码、反码、补码、移码
  • 原文地址:https://www.cnblogs.com/xsmhero/p/2572656.html
Copyright © 2011-2022 走看看