Print Page | Close Window

ParameterizedEsql and TOP or Take()

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2931
Printed Date: 21-Jan-2026 at 10:08pm


Topic: ParameterizedEsql and TOP or Take()
Posted By: chuckc
Subject: ParameterizedEsql and TOP or Take()
Date Posted: 26-Aug-2011 at 11:38am
Is there some way to restrict the number of returned entities when using ParameterizedEsql?  Take() is not supported by PassthruEsqlQuery, and my first couple tries at using TOP embedded in the sql string weren't successful.

Thanks for any help.



Replies:
Posted By: robertg
Date Posted: 26-Aug-2011 at 12:38pm

Chuck,

It appears that in ESQL (and not just our implementation via PassThruEsqlQuery), you have to implement the ORDER BY keyword with LIMIT() to limit the number of responses returned. For example the following simple query is valid, and returns the expected results:
 

_em1 = new NorthwindIBEntities();

var query0 = new PassthruEsqlQuery(typeof(Customer),"SELECT VALUE c FROM Customers AS c order by c.CustomerID limit(5)");

var result0 = query0.With(_em1).Execute().Cast<Customer>();

Yours,
Robert



Print Page | Close Window