About class SqlServer2000 GetPagedSelectSqlStatement

Jan 11, 2009 at 11:33 AM
Edited Jan 11, 2009 at 11:37 AM
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.GetColumns(this),
                ssb.From.ToSqlText(dpc, this),
                ssb.Where.ToSqlText(dpc, this),
                (ssb.Order == null || ssb.Keys.Count == 0) ? "" : ssb.Order.ToSqlText(dpc, this),
                ssb.Range.EndIndex
                );
            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....
Coordinator
Jan 12, 2009 at 1:36 AM
Edited Jan 12, 2009 at 1: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:
http://llf.hanzify.org/llf/show.asp?ID=316
http://llf.hanzify.org/llf/show.asp?ID=324
http://llf.hanzify.org/llf/show.asp?ID=325

And there is another article maybe you want read:
http://llf.hanzify.org/llf/show.asp?ID=553

PS: thanks for your compliment :)