About class SqlServer2000 GetPagedSelectSqlStatement

Jan 11, 2009 at 12:33 PM
Edited Jan 11, 2009 at 12:37 PM
Your code is 

        protected override SqlStatement GetPagedSelectSqlStatement(SelectStatementBuilder ssb)
            var dpc = new DataParamterCollection();
            string SqlString = string.Format("Select Top {4} {0} From {1}{2}{3}",
                ssb.From.ToSqlText(dpc, this),
                ssb.Where.ToSqlText(dpc, this),
                (ssb.Order == null || ssb.Keys.Count == 0) ? "" : ssb.Order.ToSqlText(dpc, this),
            return new TimeConsumingSqlStatement(CommandType.Text, SqlString, dpc);

is there any other better solution?

if the data is huge... will it be slow?

PS: I said to myself every day "dbentry is tai niu bi le" ....you are a Incredible man....
Jan 12, 2009 at 2:36 AM
Edited Jan 12, 2009 at 2:48 AM
>>If the data is huge... will it be slow?
It depends on which page you want to get.
If it is the first page, it will as fast as other solutions.
If it is the secend page, it will a little solower than first page.
If it is the last page, it will be slow.

And it also depends on if the application server and the database server is the same server. If so, it will fast, if not, it will be slower.

But, in DbEntry, it just skipped the records it don't need, so even it is the last page, it will not too slow.

I wrote some articles to discuss this before:

And there is another article maybe you want read:

PS: thanks for your compliment :)