asp如何取出第几条到第几条数据

asp如何取出第几条到第几条数据,第1张

取n到m条记录的语句

1

select top m from tablename where id not in (select top n from tablename)

2

select top m into 临时表(或表变量) from tablename order by columnname -- 将top m笔插入

set rowcount n

select from 表变量 order by columnname desc

3

select top n from

(select top m from tablename order by columnname) a

order by columnname desc

4如果tablename里没有其他identity列,那么:

select identity(int) id0, into #temp from tablename

取n到m条的语句为:

select from #temp where id0 >=n and id0 <= m

如果你在执行select identity(int) id0, into #temp from tablename这条语句的时候报错,那是因为你的DB中间的select into/bulkcopy属性没有打开要先执行:

exec sp_dboption 你的DB名字,'select into/bulkcopy',true

5如果表里有identity属性,那么简单:

select from tablename where identitycol between n and m

dates = FormatDateTime("2009-8-18 22:56:10",2)

select from 数据表 where 时间 = '& dates &'

照上面的写就好了,这样得到的dates是 2009-8-18

FormatDateTime() 这个函数后面的 2 这个参数可以修改的,具体的参数说明,你再参考手册。

这个应该用SQL语句就可以判断了

set rs = serverCreateObject("ADODBRecordSet")

rsopen "select count() as rep from jcs where zhanghao = '"&文本域textfield中的zhanghao值&"' ",conn,1,1

if not rseof and not rsbof then

if cint(rs("rep")) > =3 then

responsewrite "已有3条相同记录"

elseif cint(rs("rep")) = 0 then

responsewrite "数据库中无此相关记录"

else

responsewrite "数据库中存在3条不到相同记录"

end if

end if

rsclose

set rs = nothing

方法1,以数组下标的形式读出无字段名的数据

<%

dim sum

sum=connexecute("select count() from [company_fbzw]")

responseWrite(sum(0))

%>

或者

方法2,以数组下标的形式读出,或者以字段名读出数据

<%

dim sum

sum=connexecute("select count() as iTotail from [company_fbzw]")

responseWrite(sum("iTotail"))

'也可下面的语句

'responseWrite(sum(0))

%>

用三条查询语句分别查询出来吧

select count(id) from 表名 where lb='上海'

select count(id) from 表名 where lb='北京'

select count(id) from 表名 where lb='南京'

分别执行不就出来了

这个真不是你想快就能快的。ASP从数据库读取三万条数据这是一瞬间的事,也许就是几十毫秒的时间。但问题在于它把数据发送到你的浏览器时,这个速度就不是由程序所能决定的了。假如你的每条数据有200个字节(这个算是很保守的估计了),三万条数据就是57M,这还只是纯数据,如果再加上HTML标签就要接近10M,按照中国平均网速32M来算,实际下行速率就是400KB/s,则10M的网页数据在理想状态下就要25秒左右才能传送完毕。

对于ASP而言,能做的就是尽量减少发送的数据量,比如只发数据,不发任何修饰标签,由客户端(即浏览器)再通过JS代码对显示效果进行修饰;还可以对数据进行压缩等等。剩下的就是听天由命了。

此外,你的不分页的要求确实太苛刻了,这可是网络耶,不是你自家的硬盘!也许等以后千兆宽带成为现实后(中国肯定要打个折扣,有200M就谢天谢地了),你的梦想才能实现。

以上就是关于asp如何取出第几条到第几条数据全部的内容,包括:asp如何取出第几条到第几条数据、asp 查询 当天的数据条数. 数据库时间是2009-8-18 22:56:10、asp页面如何判断数据库中有多少条记录等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/9561467.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-29
下一篇2023-04-29

发表评论

登录后才能评论

评论列表(0条)

    保存