代码没有拉足够的记录 [英] Code not pulling enough records

查看:55
本文介绍了代码没有拉足够的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿帮派。

我有一个代码,我将列出。当varM = 8或16时,脚本工作正常,

并拉出前8或前16,但如果它= 32或64,它只拉动

来自DB的前17条记录。

db是访问权限,这是MS服务器。

这里是代码


< %

如果varm = 8则

设置admin6 = conn.execute("选择前8位用户名,iCHECK来自

members2_tourney其中tourney_id = &&;& varID&"")

否则如果varm = 16那么

set admin6 = conn.execute(" select top 16 username,iCHECK from

members2_tourney其中tourney_id ="& varID&"")

else如果varm = 32则

set admin6 = conn .execute(" select top 32 username,iCHECK from

members2_tourney where tourney_id ="& varID&"")

else if varm = 64 then

set admin6 = conn.execute(" select top 64 username,iCHECK from

members2_tourney w这里tourney_id =" &安培; varID& ")

其他

结束如果

结束如果

结束如果

结束如果


如果不是admin6.EOF而不是admin6.BOF那么


do do admin6.eof


varnm = admin6.fields.item(" username")。value

varch = admin6.fields.item(" iCHECK")。value


如果varch ="是"然后

rowcolor ="#4477aa"

fontcolor =" #ffffff"

else

rowcolor = " #FFFFF"

fontcolor ="#000000"

结束如果


%>


我需要知道的是,是否还有另一种方法可以从数据库中提取一定数量的

记录。之所以它是8的多重,是因为这是锦标赛网站的b $ b,所以括号设置为8的倍数

任何想法?

解决方案

我甚至尝试在没有if语句的情况下将变量放在

语句中。

set admin6 = conn.execute(" select top"& varm&" username,iCHECK from

members2_tourney where tourney_id ="& varID&"")


i尝试使用response.write来查看传递的内容,并且传递了正确的

信息,它只是没有获得32或64条记录。 br />
对TOP函数中可以使用的内容有限制吗?


" Jeff" < GI ***** @ adelphia.net>在留言中写道

新闻:fN ****************************** @ adelphia.com .. 。

嘿帮派。
我有一个代码,我将列出。当varM = 8或16时,脚本工作正常,并拉出前8或前16,但如果它= 32或64,它只是从数据库中拉出前17条记录。 br /> db是访问权限,这是MS服务器。
这里是代码

<%
如果varm = 8那么
设置admin6 = conn.execute (选择前8个用户名,iCHECK来自
members2_tourney,其中tourney_id ="& varID&"")
如果varm = 16则
设置admin6 = conn.execute (选择前16位用户名,iCHECK来自
members2_tourney,其中tourney_id ="& varID&"")
如果varm = 32则
设置admin6 = conn.execute (选择前32名用户名,iCHECK来自
members2_tourney,其中tourney_id ="& varID&"")
如果varm = 64则
设置admin6 = conn.execute (选择前64位用户名,iCHECK来自
members2_tourney其中tourney_id ="& varID&""


结束如果
结束如果结束如果
结束如果

如果不是admin6.OF而不是admin6.BOF然后

做而不是admin6.eof
varnm = admin6.fields.item(" username")。value
varch = admin6.fields.item(" iCHECK")。value

if varch = "是"然后
rowcolor ="#4477aa"
fontcolor =" #fffff"

rowcolor =" #FFFFF"
fontcolor ="#000000"
结束如果

%>

我需要知道的是,是否还有另一种方法可以从中获取一定数量的记录D B。之所以它是8的多重,是因为这是一个锦标赛网站,所以括号设置为8的倍数
任何想法?



Jeff写道:

嘿帮派。
我有一个代码,我将列出。当varM = 8或16时,脚本工作正常,并拉出前8或前16,但如果它= 32或64,它只是从数据库中拉出前17条记录。 br /> db是访问权限,这是MS服务器。
这里是代码

<%
如果varm = 8那么
设置admin6 = conn.execute (选择前8个用户名,iCHECK来自
members2_tourney,其中tourney_id ="& varID&"")
如果varm = 16则
设置admin6 = conn.execute (选择前16位用户名,iCHECK来自
members2_tourney,其中tourney_id ="& varID&"")
如果varm = 32则
设置admin6 = conn.execute (选择前32名用户名,iCHECK来自
members2_tourney,其中tourney_id ="& varID&"")
如果varm = 64则
设置admin6 = conn.execute (选择前64位用户名,iCHECK来自
members2_tourney其中tourney_id ="& varID&""


结束如果
结束如果结束如果结束如果


OMG

这样做:

dim sql

if varm> 0然后

sql =" select top" &安培; varm& "用户名,iCHECK来自 &安培; _

" members2_tourney其中tourney_id =" &安培; varID& "

Response.write sql

设置admin6 = conn.execute(sql ,, 1)

如果不是admin6.EOF那么''没有必要同时检查EOF和BOF

如果不是admin6.OF而不是admin6.BOF然后

做的同时不是admin6.eof
varnm = admin6.fields.item(" username")。value
varch = admin6.fields.item(" iCHECK")。value

if varch =" Yes"然后
rowcolor ="#4477aa"
fontcolor =" #fffff"

rowcolor =" #FFFFF"
fontcolor ="#000000"
结束如果

%>

我需要知道的是,是否有另一种方法可以从中获取一定数量的记录D B。


编号不是来自Access,无论如何。

我很高兴看到你决定使用TOP。较小的程序员会从数据库中提取所有记录并仅处理他们需要的b $ b $

原因是多少8,因为这是一个锦标赛网站,所以括号设置为8
的倍数

无关:-)

任何想法??




你上面的东西应该有用。对TOP我没有限制我知道

。如果你从

asp运行查询时真的只得到17条记录,那么在Access中运行相同的查询返回32,那么我需要看到一个

repro。 br />

-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。这个电子邮件帐户是我的垃圾邮件陷阱所以我

不经常检查它。如果您必须离线回复,请删除

无垃圾邮件


确定,这里是response.write


选择前32个用户名,iCHECK来自members2_tourney,其中tourney_id = 12


所以它应该根据变量选择top32。然而,

并不是它在页面上显示的内容。

这里是页​​面。我只是扔了一些名字,所以我可以测试一些东西

http://gig-gamers.com/tourney-zone/t...?tourney_id=12

Bob Barrows [MVP] " <再****** @ NOyahoo.SPAMcom>在消息中写道

新闻:eV ************** @ TK2MSFTNGP09.phx.gbl ...

Jeff写道:

嘿帮派。
我有一个代码,我将列出。当varM = 8或16时,脚本工作正常,并拉出前8或前16,但如果它= 32或64,它只是从数据库中拉出前17条记录。 br /> db是访问权限,这是MS服务器。
这里是代码

<%
如果varm = 8那么
设置admin6 = conn.execute (选择前8个用户名,iCHECK来自
members2_tourney,其中tourney_id ="& varID&"")
如果varm = 16则
设置admin6 = conn.execute (选择前16位用户名,iCHECK来自
members2_tourney,其中tourney_id ="& varID&"")
如果varm = 32则
设置admin6 = conn.execute (选择前32名用户名,iCHECK来自
members2_tourney,其中tourney_id ="& varID&"")
如果varm = 64则
设置admin6 = conn.execute (选择前64位用户名,iCHECK来自
members2_tourney其中tourney_id ="& varID&""


结束如果
结束如果
结束如果



OMG
这样做:
dim sql
如果varm> 0然后
sql =" select top" &安培; varm& "用户名,iCHECK来自 &安培; _
" members2_tourney其中tourney_id =" &安培; varID& "
Response.write sql
设置admin6 = conn.execute(sql ,, 1)
如果不是admin6.EOF则''无需检查EOF和BOF


如果不是admin6.OFOF而不是admin6.BOF那么

做的时候不管理。

varnm = admin6 .fields.item(" username")。value
varch = admin6.fields.item(" iCHECK")。value

if varch =" Yes"然后
rowcolor ="#4477aa"
fontcolor =" #fffff"

rowcolor =" #FFFFF"
fontcolor ="#000000"
结束如果

%>

我需要知道的是,是否有另一种方法可以从中获取一定数量的记录DB。



不,不是来自Access。
我很高兴看到你决定使用TOP。较小的程序员会从数据库中提取所有记录并仅处理他们需要的记录。

原因是它的多数为8,是<因为这是一个锦标赛网站,所以括号设置为8的倍数



无关:-)

任何想法?



上面的内容应该有效。我知道
对TOP没有限制。如果你在从
asp运行查询时真的只得到17条记录,那么在Access中运行相同的查询返回32,那么我需要看一个
repro。

- -
Microsoft MVP - ASP / ASP.NET
请回复新闻组。这个电子邮件帐户是我的垃圾邮件陷阱所以我不经常检查它。如果您必须离线回复,请删除
NO SPAM



Hey gang.
i have a code that i will list. when varM = 8 or 16, the script works fine,
and pulls the top 8 or top 16, but if it =32 or 64, it is only pulling the
top 17 records from the DB.
db is access and this is MS server.
here is the code

<%
if varm = 8 then
set admin6 = conn.execute("select top 8 username, iCHECK from
members2_tourney where tourney_id = " & varID & "")
else if varm = 16 then
set admin6 = conn.execute("select top 16 username, iCHECK from
members2_tourney where tourney_id = " & varID & "")
else if varm = 32 then
set admin6 = conn.execute("select top 32 username, iCHECK from
members2_tourney where tourney_id = " & varID & "")
else if varm = 64 then
set admin6 = conn.execute("select top 64 username, iCHECK from
members2_tourney where tourney_id = " & varID & "")
else
end if
end if
end if
end if

IF NOT admin6.EOF AND NOT admin6.BOF THEN

do while not admin6.eof

varnm = admin6.fields.item("username").value
varch = admin6.fields.item("iCHECK").value

if varch = "Yes" then
rowcolor = "#4477aa"
fontcolor = "#ffffff"
else
rowcolor = "#FFFFFF"
fontcolor= "#000000"
end if

%>

what i need to know, is if there is another way to pull a certain amount of
records from a DB. the reason it is in mulitples of 8, is because this is
for a tournament site, so the brackets are set in multiples of 8
any ideas??

解决方案

i even tried without the if statements by putting the variable in the
statement.
set admin6 = conn.execute("select top " & varm & " username, iCHECK from
members2_tourney where tourney_id = " & varID & "")

i tried using response.write to see what is being passed, and the correct
information is being passed, it just isn''t getting 32 or 64 records.
is there a limit on what can be used in a TOP function??

"Jeff" <gi*****@adelphia.net> wrote in message
news:fN******************************@adelphia.com ...

Hey gang.
i have a code that i will list. when varM = 8 or 16, the script works
fine, and pulls the top 8 or top 16, but if it =32 or 64, it is only
pulling the top 17 records from the DB.
db is access and this is MS server.
here is the code

<%
if varm = 8 then
set admin6 = conn.execute("select top 8 username, iCHECK from
members2_tourney where tourney_id = " & varID & "")
else if varm = 16 then
set admin6 = conn.execute("select top 16 username, iCHECK from
members2_tourney where tourney_id = " & varID & "")
else if varm = 32 then
set admin6 = conn.execute("select top 32 username, iCHECK from
members2_tourney where tourney_id = " & varID & "")
else if varm = 64 then
set admin6 = conn.execute("select top 64 username, iCHECK from
members2_tourney where tourney_id = " & varID & "")
else
end if
end if
end if
end if

IF NOT admin6.EOF AND NOT admin6.BOF THEN

do while not admin6.eof

varnm = admin6.fields.item("username").value
varch = admin6.fields.item("iCHECK").value

if varch = "Yes" then
rowcolor = "#4477aa"
fontcolor = "#ffffff"
else
rowcolor = "#FFFFFF"
fontcolor= "#000000"
end if

%>

what i need to know, is if there is another way to pull a certain amount
of records from a DB. the reason it is in mulitples of 8, is because this
is for a tournament site, so the brackets are set in multiples of 8
any ideas??



Jeff wrote:

Hey gang.
i have a code that i will list. when varM = 8 or 16, the script works
fine, and pulls the top 8 or top 16, but if it =32 or 64, it is only
pulling the top 17 records from the DB.
db is access and this is MS server.
here is the code

<%
if varm = 8 then
set admin6 = conn.execute("select top 8 username, iCHECK from
members2_tourney where tourney_id = " & varID & "")
else if varm = 16 then
set admin6 = conn.execute("select top 16 username, iCHECK from
members2_tourney where tourney_id = " & varID & "")
else if varm = 32 then
set admin6 = conn.execute("select top 32 username, iCHECK from
members2_tourney where tourney_id = " & varID & "")
else if varm = 64 then
set admin6 = conn.execute("select top 64 username, iCHECK from
members2_tourney where tourney_id = " & varID & "")
else
end if
end if
end if
end if
OMG
Do this:
dim sql
if varm > 0 then
sql="select top " & varm & " username, iCHECK from " & _
"members2_tourney where tourney_id = " & varID & ""
Response.write sql
Set admin6=conn.execute(sql,,1)
If not admin6.EOF then ''no need to check both EOF and BOF

IF NOT admin6.EOF AND NOT admin6.BOF THEN

do while not admin6.eof

varnm = admin6.fields.item("username").value
varch = admin6.fields.item("iCHECK").value

if varch = "Yes" then
rowcolor = "#4477aa"
fontcolor = "#ffffff"
else
rowcolor = "#FFFFFF"
fontcolor= "#000000"
end if

%>

what i need to know, is if there is another way to pull a certain
amount of records from a DB.
No. Not from Access, anyways.
I''m happy to see that you decided to use TOP. Lesser programmers would have
pulled ALL the records from the database and processed only the ones they
needed.
the reason it is in mulitples of 8, is
because this is for a tournament site, so the brackets are set in
multiples of 8
irrelevant :-)
any ideas??



What you have above should work. There is no limitation on TOP that I know
of. If you are really only getting 17 records when running the query from
asp, wihile the same query run in Access returns 32, then I need to see a
repro.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don''t check it very often. If you must reply off-line, then remove the
"NO SPAM"


ok, here is the response.write

select top 32 username, iCHECK from members2_tourney where tourney_id = 12

so it should be selecting the top32 based of the variable. however, that
isn''t what it is showing on the page.
here is the page. i just threw in some names so i could test stuff

http://gig-gamers.com/tourney-zone/t...?tourney_id=12
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:eV**************@TK2MSFTNGP09.phx.gbl...

Jeff wrote:

Hey gang.
i have a code that i will list. when varM = 8 or 16, the script works
fine, and pulls the top 8 or top 16, but if it =32 or 64, it is only
pulling the top 17 records from the DB.
db is access and this is MS server.
here is the code

<%
if varm = 8 then
set admin6 = conn.execute("select top 8 username, iCHECK from
members2_tourney where tourney_id = " & varID & "")
else if varm = 16 then
set admin6 = conn.execute("select top 16 username, iCHECK from
members2_tourney where tourney_id = " & varID & "")
else if varm = 32 then
set admin6 = conn.execute("select top 32 username, iCHECK from
members2_tourney where tourney_id = " & varID & "")
else if varm = 64 then
set admin6 = conn.execute("select top 64 username, iCHECK from
members2_tourney where tourney_id = " & varID & "")
else
end if
end if
end if
end if



OMG
Do this:
dim sql
if varm > 0 then
sql="select top " & varm & " username, iCHECK from " & _
"members2_tourney where tourney_id = " & varID & ""
Response.write sql
Set admin6=conn.execute(sql,,1)
If not admin6.EOF then ''no need to check both EOF and BOF


IF NOT admin6.EOF AND NOT admin6.BOF THEN

do while not admin6.eof

varnm = admin6.fields.item("username").value
varch = admin6.fields.item("iCHECK").value

if varch = "Yes" then
rowcolor = "#4477aa"
fontcolor = "#ffffff"
else
rowcolor = "#FFFFFF"
fontcolor= "#000000"
end if

%>

what i need to know, is if there is another way to pull a certain
amount of records from a DB.



No. Not from Access, anyways.
I''m happy to see that you decided to use TOP. Lesser programmers would
have pulled ALL the records from the database and processed only the ones
they needed.

the reason it is in mulitples of 8, is
because this is for a tournament site, so the brackets are set in
multiples of 8



irrelevant :-)

any ideas??



What you have above should work. There is no limitation on TOP that I know
of. If you are really only getting 17 records when running the query from
asp, wihile the same query run in Access returns 32, then I need to see a
repro.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don''t check it very often. If you must reply off-line, then remove the
"NO SPAM"



这篇关于代码没有拉足够的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆