public static DataTable TrimDataTable(DataTable dataTable, int noOfRows)
        {
            DataRow[] dataRows = dataTable.Select();
            DataTable filteredDataTable = dataTable.Clone();
            for (int i = 0; i < dataRows.Length; i++)
            {
                filteredDataTable.ImportRow(dataRows[i]);
                if (i >= noOfRows - 1)
                    break;
            }
            return filteredDataTable;
        }
No comments:
Post a Comment