Generate NEWID() Code Loop

Posts   
 
    
quandb
User
Posts: 2
Joined: 14-Mar-2017
# Posted on: 14-Mar-2017 09:20:03   

LLBLGEN v5.1 - self servicing VB .NET 4.0

Hi support team

I try to using random function in sql with Sorter newID but when it excute to GetMulti. It still loop there forever. Are you have any suggestion for this problem ? Regard.

Real code :


        Dim col = New Som0EmailQueueCollection()

        Dim qf = New QueryFactory()

        Dim newIdField = EntityFieldFactory.Create(IRIS.Som0EmailQueueFieldIndex.Id)
        newIdField.Alias = "newid()"
        newIdField.ExpressionToApply = New Expression()

        Dim sorter = New SortExpression()
        sorter.Add(New SortClause(newIdField, SortOperator.Ascending))

        col.GetMulti(Nothing, 0, sorter)

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 14-Mar-2017 10:44:38   

You fetch all the data, so if there are millions of rows in the table, it will take a while.

our tests work fine:


IEntityField newIDField = CustomerFields.Country;
newIDField.Alias = "NEWID()";
newIDField.ExpressionToApply = new Expression();

ISortExpression sorter = new SortExpression(new SortClause(newIDField, SortOperator.Ascending));
CustomerCollection customers = new CustomerCollection();
customers.GetMulti(null, 0, sorter, null);

Your instance of the queryfactory isn't needed btw...

Frans Bouma | Lead developer LLBLGen Pro
quandb
User
Posts: 2
Joined: 14-Mar-2017
# Posted on: 14-Mar-2017 12:54:10   

Otis wrote:

You fetch all the data, so if there are millions of rows in the table, it will take a while.

our tests work fine:


IEntityField newIDField = CustomerFields.Country;
newIDField.Alias = "NEWID()";
newIDField.ExpressionToApply = new Expression();

ISortExpression sorter = new SortExpression(new SortClause(newIDField, SortOperator.Ascending));
CustomerCollection customers = new CustomerCollection();
customers.GetMulti(null, 0, sorter, null);

Your instance of the queryfactory isn't needed btw...

Thanks for your help!