Click here to Skip to main content
12,952,792 members (35,992 online)
Click here to Skip to main content

Stats

31.9K views
471 downloads
48 bookmarked
Posted 27 Oct 2008

Fast GridView

, 4 Nov 2008 CPOL
A fast and optimized GridView.
To test this code :
1-download the AdventureWorks database  at http://www.microsoft.com/downloads/details.aspx?familyid=e719ecf7-9f46-4312-af89-6ad8702e4e6e&displaylang=en
2-execute stored procedure on sql server:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

CREATE PROCEDURE [dbo].[ProductsByRows] 
(@pBegin int,
 @pEnd int)
AS
 With Prod AS 
( SELECT [ProductID], 
		 [ProductName], 
		 [SupplierID], 
		 [CategoryID], 
		 [QuantityPerUnit], 
		 [UnitPrice], 
		 [UnitsInStock], 
		 [UnitsOnOrder], 
		 [ReorderLevel], 
		 [Discontinued] ,  
		 ROW_NUMBER() OVER (order by ProductName) as RowNumber from Products )
		 SELECT [ProductID], 
		[ProductName], 
		[SupplierID], 
		[CategoryID], 
		[QuantityPerUnit], 
		[UnitPrice], 
		[UnitsInStock], 
		[UnitsOnOrder], 
		[ReorderLevel], 
		[Discontinued] from Prod  Where RowNumber 
Between @pBegin and @pEnd 

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

David Zenou
Software Developer Several
France France
Fan of .NET Technologies
Go to see my blog : http://davidzenou.blogspot.com/2009/01/david.html

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170525.1 | Last Updated 4 Nov 2008
Article Copyright 2008 by David Zenou
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid