有做索引的,如何限制打开几千条?我只能在结果集打开后,控制显示结果的数量,使其分页显示,但是我无法在运行这样的语句时控制:rst.open strSql。
程序跟踪每到此,会停好一会儿,然后说:Timeout expire。
在设置connectiontimeout=600,仍没有作用!在不到600s的时间就报此错误!
程序跟踪每到此,会停好一会儿,然后说:Timeout expire。
在设置connectiontimeout=600,仍没有作用!在不到600s的时间就报此错误!
调试欢乐多
strSql你可以用下面的语句定义:
一页显示m个。
第n页:
strSql="select top m * from (select Top (m*n) * from your_table)"
前一页:strSql="select top m * from (select Top ((n-1)*m) * from your_table)"
后一页:strSql="select top m * from (select Top ((n+1)*m) * from your_table)"
就行了。
我猜想你是用下面语句的吧:
strSql="select * from your_table"
littleboysss兄,把你的代码发给我。你的别的代码有问题。
我是用delphi的Tquery控件写的一个Isapi查询,你的sqlstr它可能能在vb下运行。
我在Query Analyzer下没成功,能在Query Analyzer或存储过程中下运行吗?
怎么用存储过程来分页?
谢谢yangzi兄。
SELECT *
FROM t_table_name
WHERE rownum<A+B
MINUS
SELECT * FROM t_table_name
WHERE rownum<A;
第n页:
strSql="select top m * from (select Top (m*n) * from your_table)as tablea "
前一页:strSql="select top m * from (select Top ((n-1)*m) * from your_table)as tablea"
后一页:strSql="select top m * from (select Top ((n+1)*m) * from your_table)as tablea "
比如在oracle下返回5至10条记录可写为:
SELECT * from test_table WHERE rownum<11
MINUS
SELECT * FROM test_table WHERE rownum<6;
而如果我在sql server下用select top 5 from(select top 10 from test_table) as tablea,它只能返回1~5条记录。甚至5和10的位置对调也返回前5条。
当然,通过设置标志的方法可以完成分页,但是难道sql server就不能象oracle一样自由返回特定记录吗?fangkuntao兄:你是如何做到的,能告诉我吗?谢谢!!!本人菜鸟一个,希望各位大侠帮助!!!
第n页:
strSql="select top m * from (select Top (m*n) * from your_table order by your_id desc)as tablea "
前一页:strSql="select top m * from (select Top ((n-1)*m) * from your_table order by your_id desc)as tablea"
后一页:strSql="select top m * from (select Top ((n+1)*m) * from your_table order by your_id desc)as tablea "
这回肯定没问题了。