HomeActive Query BuilderTop

Top


Where can i find the object that keep the top count
Shlomo | email
March 23 2008, 06:15 AM
Hi,

Use the following code if you work with MS SQL Server. Otherwise, please tell us your database server so we can provide you with the right way to set it.

SQLSubQuerySelectExpression selexpr = queryBuilder1.ActiveSubQuery.ActiveUnionSubquery.QueryAST;
MSSQLSubQuerySelectExpressionExtender extender = (MSSQLSubQuerySelectExpressionExtender) selexpr.Extender;

// TOP n
SQLSubQueryTopRows top = new SQLSubQueryTopRows(queryBuilder1.SyntaxProvider);
// TOP n PERCENT
//SQLSubQueryTopPercent top = new SQLSubQueryTopPercent(queryBuilder1.SyntaxProvider);

// ... WITH TIES
//top.WithTies = new SQLSubQueryTopWithTies(queryBuilder1.SyntaxProvider);

top.Count = new AstTokenNumber(queryBuilder1.SyntaxProvider);
top.Count.Token = "10";
extender.Top = top;

queryBuilder1.ActiveSubQuery.ActiveUnionSubquery.NotifySQLUpdated();

Sergey
Sergey Smagin | email
1 day since original post
This topic is closed