Asad khan

Asad khan

  • NA
  • 208
  • 98.4k

how to used sql server query in asp.net

Oct 27 2016 1:28 AM
 used this query in asp.net for pagination?
 
DECLARE @PageNumber AS INT, @RowspPage AS INT
SET @PageNumber = 4
SET @RowspPage = 500
SELECT [Id]
,[Name]
,[UserName]
,[Password]
,[Gender]
,[Age]
,[Address]
FROM [Regdb].[dbo].[TblReg]
ORDER BY [Id]
OFFSET ((@PageNumber - 1) * @RowspPage) ROWS
FETCH NEXT @RowspPage ROWS ONLY;
 
 
And my asp.net select query is that,
 
System.Data.SqlClient.SqlDataAdapter ad = new System.Data.SqlClient.SqlDataAdapter("select top ("+ PAGESIZE + ") * from TblReg ", con); 

Answers (2)