0

Is it possible to perform a select top (n) query in llblgen pro?...not LINQ. If so, how can I achieve that using the SelfServicing?

Saif Khan
  • 18,402
  • 29
  • 102
  • 147

1 Answers1

4

Just use the GelMulti overloads that accepts the maxItemsToReturn parameter:

int itemsToReturn = 10;    
OrderCollection orders = new OrderCollection();
orders.GetMulti(null, itemsToReturn);

This is the generated SQL:

SELECT TOP(@p2) [Northwind].[dbo].[Orders].[CustomerID] AS [CustomerId], ... 
FROM [Northwind].[dbo].[Orders]  
Parameter: @p2 : Int64. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 10.
David Elizondo
  • 1,123
  • 1
  • 7
  • 16
  • 1
    I just wanted to add that you can add a diagnostic switch to your app.config or web.config to see in the output window the generated sql. Here is a Sql 2008 example - – Kris Krause Aug 30 '11 at 16:59