I am looking at the query generated and it does not have the order by clause in it. Here is what is being generated by the code from my last post.
Method Enter: CreateSelectDQ (Paging)
Method Enter: CreateSelectDQ
Generated Sql query:
Query: SELECT DISTINCT [WS2].[dbo].[PhotoGallery].[BuildID] AS [BuildID],[WS2].[dbo].[PhotoGallery].[ProductVersionID] AS [ProductVersionID],[WS2].[dbo].[PhotoGallery].[BikeImage] AS [BikeImage],[WS2].[dbo].[PhotoGallery].[ManufacturerID] AS [CompanyID],[WS2].[dbo].[PhotoGallery].[Manufacturer] AS [Manufacturer],[WS2].[dbo].[PhotoGallery].[ManufacturerImage] AS [ManufacturerImage],[WS2].[dbo].[PhotoGallery].[ProductID] AS [ProductID],[WS2].[dbo].[PhotoGallery].[Model] AS [Model],[WS2].[dbo].[PhotoGallery].[StyleCode] AS [StyleCode] FROM [WS2].[dbo].[PhotoGallery] WHERE ( [WS2].[dbo].[PhotoGallery].[StyleCode] = @StyleCode1) ORDER BY [WS2].[dbo].[PhotoGallery].[Manufacturer] ASC,[WS2].[dbo].[PhotoGallery].[Model] ASC
Parameter: @StyleCode1 : AnsiStringFixedLength. Length: 2. Precision: 0. Scale: 0. Direction: Input. Value: R.
Method Exit: CreateSelectDQ
Generated Sql query:
Query: CREATE TABLE #TempTable ([__rowcnt][int] IDENTITY (1,1) NOT NULL,[BuildID][Int] NULL,[ProductVersionID][Int] NULL,[BikeImage][VarChar](50) NULL,[CompanyID][Int] NULL,[Manufacturer][VarChar](50) NULL,[ManufacturerImage][VarChar](50) NULL,[ProductID][Int] NULL,[Model][VarChar](50) NULL,[StyleCode][Char](2) NULL);INSERT INTO #TempTable ([BuildID],[ProductVersionID],[BikeImage],[CompanyID],[Manufacturer],[ManufacturerImage],[ProductID],[Model],[StyleCode]) SELECT DISTINCT TOP 5 [WS2].[dbo].[PhotoGallery].[BuildID] AS [BuildID],[WS2].[dbo].[PhotoGallery].[ProductVersionID] AS [ProductVersionID],[WS2].[dbo].[PhotoGallery].[BikeImage] AS [BikeImage],[WS2].[dbo].[PhotoGallery].[ManufacturerID] AS [CompanyID],[WS2].[dbo].[PhotoGallery].[Manufacturer] AS [Manufacturer],[WS2].[dbo].[PhotoGallery].[ManufacturerImage] AS [ManufacturerImage],[WS2].[dbo].[PhotoGallery].[ProductID] AS [ProductID],[WS2].[dbo].[PhotoGallery].[Model] AS [Model],[WS2].[dbo].[PhotoGallery].[StyleCode] AS [StyleCode] FROM [WS2].[dbo].[PhotoGallery] WHERE ( [WS2].[dbo].[PhotoGallery].[StyleCode] = @StyleCode1) ORDER BY [WS2].[dbo].[PhotoGallery].[Manufacturer] ASC,[WS2].[dbo].[PhotoGallery].[Model] ASC;SELECT [BuildID],[ProductVersionID],[BikeImage],[CompanyID],[Manufacturer],[ManufacturerImage],[ProductID],[Model],[StyleCode] FROM #TempTable WHERE [__rowcnt] > @__rownoStart AND [__rowcnt] <= @__rownoEnd;DROP TABLE #TempTable
Parameter: @StyleCode1 : AnsiStringFixedLength. Length: 2. Precision: 0. Scale: 0. Direction: Input. Value: R.
Parameter: @__rownoStart : Int32. Length: 4. Precision: 10. Scale: 0. Direction: Input. Value: 0.
Parameter: @__rownoEnd : Int32. Length: 4. Precision: 10. Scale: 0. Direction: Input. Value: 4.
Method Exit: CreateSelectDQ (Paging)