locked
Custom Paging RRS feed

  • Question

  • User1979860870 posted

    Hi

    how to create Google like custom paging using Stored Procedure IN ASP.NET CORE . I have below Stored Procedure.

    CREATE PROCEDURE PagedResults_New
    (
       @startRowIndex      int,
       @maximumRows      int
    )
    AS
    
    
    DECLARE @tmp TABLE
    (
       ID int ,
       AccountNo char(30),
       Amount decimal (18,2)
    )
    
    -- Insert the rows from tblItems into the temp. table
    INSERT INTO @tmp (ID,AccountNo , Amount)
    SELECT No,AccountNo,Amount
    FROM tbl1
    
    -- Now, return the set of paged records
    SELECT e.*
    FROM @tmp t INNER JOIN tbl1 e ON
          e.No = t.ID
       WHERE ID BETWEEN (@startRowIndex  * @maximumRows) + 1 AND (@startRowIndex * @maximumRows) + @maximumRows
    GO

    Thanks

    Tuesday, January 19, 2021 6:44 AM

All replies

  • User503812343 posted

    you will have to use SQL function row_number or dense to fetch only required data.

    select col1, col2, col3
    from
        (SELECT e.col1, e.col2, e.col3, ROW_NUMBER() OVER(ORDER BY ID ASC) as [rownumber]
    FROM @tmp t INNER JOIN tbl1 e ON
          e.No = t.ID
    ) as data
    where rownumber> @FirstRow AND
    	rownumber< @LastRow

    for detailed steps visit - https://geeksarray.com/blog/repeater-control-and-database-level-paging

    Tuesday, January 19, 2021 1:54 PM