merlin_vista
جمعه 11 مرداد 1387, 12:46 عصر
سلام
من ميخواهم به روش sp براي Paging در GridView استفاده كنم . اين هم كد sp من هست :
CREATE PROCEDURE [dbo].[GetPagedProducts]
@PageSize int,
@CurrentPage int,
@ItemCount int output
AS
Declare @UpperBand int, @LowerBand int
-- Get The Count Of The Rows That They Meet the Criteria
SET @ItemCount = (SELECT COUNT(*) FROM TBL_Name)
-- Calculate the @LowerCount and @UpperCount
SET @LowerBand = (@CurrentPage - 1) * @PageSize
SET @UpperBand = (@CurrentPage * @PageSize) + 1
with temp AS (SELECT id, name, Famil,ROW_NUMBER() OVER (order by id) as RowNumber FROM TBL_Name )
SELECT *
FROM temp
WHERE RowNumber > @LowerBand AND RowNumber < @UpperBand
RETURN
ولي اين پيغام را ميده :
Msg 319, Level 15, State 1, Procedure GetPagedProducts, Line 17
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
ميشه من را راهنمايي كنيد . :قلب:
من ميخواهم به روش sp براي Paging در GridView استفاده كنم . اين هم كد sp من هست :
CREATE PROCEDURE [dbo].[GetPagedProducts]
@PageSize int,
@CurrentPage int,
@ItemCount int output
AS
Declare @UpperBand int, @LowerBand int
-- Get The Count Of The Rows That They Meet the Criteria
SET @ItemCount = (SELECT COUNT(*) FROM TBL_Name)
-- Calculate the @LowerCount and @UpperCount
SET @LowerBand = (@CurrentPage - 1) * @PageSize
SET @UpperBand = (@CurrentPage * @PageSize) + 1
with temp AS (SELECT id, name, Famil,ROW_NUMBER() OVER (order by id) as RowNumber FROM TBL_Name )
SELECT *
FROM temp
WHERE RowNumber > @LowerBand AND RowNumber < @UpperBand
RETURN
ولي اين پيغام را ميده :
Msg 319, Level 15, State 1, Procedure GetPagedProducts, Line 17
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
ميشه من را راهنمايي كنيد . :قلب: