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?? 10 1666
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"
in case you wanted to know how i got the data for the waiting list, here is
the code
set admin7 = conn.execute("select id, username, iCHECK from members2_tourney
where id not in (select top " & varm & " id from members2_tourney where
tourney_id = " & varID & ")")
"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"
Bob, I figured out the problem, now I need to figure a work around.
the problem is, if the varM = 32 but there are less than 32 records, it
won't return all of them.
would it be best to do a count first to see how many there are??
or how should I approach this?
"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"
Jeff wrote: Bob, I figured out the problem, now I need to figure a work around. the problem is, if the varM = 32 but there are less than 32 records, it won't return all of them.
Huh? It will return the top 32 records that satisfy your criteria. If only
17 records satisfy the criteria, that is all that will get returned. Why did
you expect anything different? Did you expect it to return 15 "empty"
records somehow?
would it be best to do a count first to see how many there are??
Why would you need to do that? When you process the recordset, you will find
out how many records there are ...
or how should I approach this?
Perhaps if you explain your requirements in a little more depth, I might be
able to make a suggestion.
Bob Barrows
--
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"
you are correct once again bob. i got it to work, and all is well as far as
that.
now if i may continue on this topic, one more delema then i will be done for
a while.
in that admin_tourney table. i have a field called pos_id this is a numeric
field, that has a value of zero to start. what i want to do, is assign a
random number between 1 however many players are in there. this will be the
position assignments in the tourney bracket.
in other words, i want to randomize the players, so they do not get put into
the bracket in the order that they signed up.
in assigning this random number, they get placed into the tourney bracket
according to that number. so my question is this,
do i call for the data, then assign the random number, then put them back?
or could i make a temp table and assign it there?
or what would be the best way to do this?
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:e4**************@TK2MSFTNGP10.phx.gbl... Jeff wrote: Bob, I figured out the problem, now I need to figure a work around. the problem is, if the varM = 32 but there are less than 32 records, it won't return all of them.
Huh? It will return the top 32 records that satisfy your criteria. If only 17 records satisfy the criteria, that is all that will get returned. Why did you expect anything different? Did you expect it to return 15 "empty" records somehow?
would it be best to do a count first to see how many there are?? Why would you need to do that? When you process the recordset, you will find out how many records there are ...
or how should I approach this? Perhaps if you explain your requirements in a little more depth, I might be able to make a suggestion.
Bob Barrows -- 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"
Jeff wrote: in assigning this random number, they get placed into the tourney bracket according to that number. so my question is this, do i call for the data, then assign the random number, then put them back?
That's what I would do. This would be one of the rare cases where I would
use a recordset to maintain the data. You can mitigate the inefficiency by
disconnecting the recordset:
set rs=createobject("adodb.recordset")
rs.cursorlocation = adUseClient
rs.open sql,conn,adOpenStatic,adLockBatchOptimistic,adCmdT ext
set rs.activeconnection=nothing
'do your updates, then
set rs.activeconnection = conn
rs.updatebatch
Bob Barrows
--
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"
as always, thanks for the help Bob!
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... Jeff wrote: in assigning this random number, they get placed into the tourney bracket according to that number. so my question is this, do i call for the data, then assign the random number, then put them back? That's what I would do. This would be one of the rare cases where I would use a recordset to maintain the data. You can mitigate the inefficiency by disconnecting the recordset:
set rs=createobject("adodb.recordset") rs.cursorlocation = adUseClient rs.open sql,conn,adOpenStatic,adLockBatchOptimistic,adCmdT ext set rs.activeconnection=nothing 'do your updates, then set rs.activeconnection = conn rs.updatebatch
Bob Barrows -- 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"
"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
[snip]
How about simplifying the code:
<%
Const cSQL = "SELECT TOP # username, iCHECK FROM members2_tourney WHERE
tourney_id = "
Set admin6 = conn.execute(Replace(cSQL,"#",varm) & varID)
Do While Not admin6.EOF
varnm = admin6("username").Value
varch = admin6("iCHECK").Value
If varch = "Yes" Then
rowcolor = "#4477aa"
fontcolor = "#ffffff"
Else
rowcolor = "#FFFFFF"
fontcolor= "#000000"
End If
%>
Or at least use "ElseIF" (no space) instead of "Else If".
Are you sure "iCHECK" returns "Yes"?
A Response.Write(varch) would confirm it. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: LRW |
last post by:
I have an automated process which uploads a comma separated
spreadsheet (csv) and inserts it into a database:
$sql = "LOAD DATA INFILE '".$uploadfile."' INTO TABLE `tbl_tracking`
FIELDS...
|
by: Mads Petersen |
last post by:
I'm stuck in this code. Hope you can and will help me. I launch it
from excel.
I have made the following code work, but not as i whant. I need the
ranges to be working with something like xlDown....
|
by: Craig831 |
last post by:
First off, I apologize if this gets long. I'm simply trying to give you all
enough information to help me out. I'm writing (almost finished, actually),
my first VB.Net application. It's a forms...
|
by: Cheryl Langdon |
last post by:
Hello everyone,
This is my first attempt at getting help in this manner. Please
forgive me if this is an inappropriate request.
I suddenly find myself in urgent need of instruction on how to...
|
by: dbarker1 |
last post by:
Hello All,
I am developing a web front end using the standard datagrid in the 1.1
framework. Currently it allows users to navigate through records 20 at
a time via previous and next buttons. ...
|
by: scolivas |
last post by:
I have a query that is pulling from a table of 35000+ records But for some reason any records beyond 25999 are not coming thru.
The Table is a list employees - and thier assignments - so there...
|
by: rdemyan via AccessMonster.com |
last post by:
I have a need to add another field to all of my tables (over 150). Not data,
but an actual field.
Can I code this somehow. So the code presumabley would loop through all the
tables, open each...
|
by: robert maas, see http://tinyurl.com/uh3t |
last post by:
I'm working on examples of programming in several languages, all
(except PHP) running under CGI so that I can show both the source
files and the actually running of the examples online. The first...
|
by: SaltyBoat |
last post by:
Needing to import and parse data from a large PDF file into an Access
2002 table: I start by converted the PDF file to a html file. Then
I read this html text file, line by line, into a table...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |