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];