I have the following code setup on my homepage. I was wondering if it would be possible to limit the output to say: 10, 15, 25 entries. Right now it seems limitless. - <%
-
rsG.open "select OrganizationId,OrganizationName,update_date from tblOrganizations where isFeatured=1 order by update_date",conn
-
rsCnt2.Open "select count(*) as cnt from tblOrganizations where isFeatured=1",conn
-
if not rsCnt2.eof then
-
finalCount=finalcount+rsCnt2("cnt")
-
end if
-
rsCnt2.close
-
-
-
numberRows=finalCount/4
-
incr=finalcount mod 4
-
numberRows=round(numberRows)+incr
-
-
if rsG.eof and rsG.bof then
-
else
-
iCol=0
-
while not rsG.EOF
-
if iCol=numberRows and finalCount>4 then
-
Response.Write "</table></td><td valign=top><table border=0>"
-
iCol=0
-
end if
-
Response.Write "<tr><td valign=top align=left><a href=groupProfile.asp?grpid=" & rsG("OrganizationID") & ">" & rsG("OrganizationName") & "</a></td></tr>"
-
iCol=iCol+1
-
rsG.MoveNext
-
wend
-
-
end if
-
-
%>
Thanks in advance
Depending on which type of db you have, one of these might work: - rsG.open "select top 25 OrganizationId,OrganizationName,..."
or - rsG.open "set rowcount 25; select OrganizationId,OrganizationName,...
let me know if this helps.
Jared
6 1787
Depending on which type of db you have, one of these might work: - rsG.open "select top 25 OrganizationId,OrganizationName,..."
or - rsG.open "set rowcount 25; select OrganizationId,OrganizationName,...
let me know if this helps.
Jared
Greatly appreciate the reply, Thank you Jared. Unfortunately neither of those worked, here is the error I got when implementing them:
I am using microsoft sql 2005 if that helps - Microsoft VBScript compilation error '800a03ea'
-
-
Syntax error
-
-
/default-new.asp, line 278
-
-
rsG.open*"select*top 25 OrganizationId,OrganizationName,update_date from tblOrganizations where isFeatured=1 order by update_date",conn
-
--------^
- Microsoft VBScript compilation error '800a03ea'
-
-
Syntax error
-
-
/default-new.asp, line 278
-
-
rsG.open*"set rowcount 25; select*OrganizationId,OrganizationName,update_date from tblOrganizations where isFeatured=1 order by update_date",conn
-
--------^
Tell me what db you are using and we can adapt this.
Otherwise we can set the numberRows variable to any arbitrary number you want.
Jared
I am using microsoft sql server 2005 on windows 2003 r2.
Oh duh, stupid mistake! I don't know where those asterisks came from, I didn't notice them when I posted that reply. When I saw it in your reply I thought it was something the error message had inserted to indicate the location of the error. I'll edit my earlier post to correct that.
Both methods should work for sql server.
Jared
Worked great!! The asterisks were what was causing my foul up. Many thanks Jared!!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: James Butler |
last post by:
Running a CLI script that fopen's a file, parses the lines into an
array, checks the array entries against a few regular expression
qualifiers (i.e. !eregi("bot",$entry)) and dump the good entries...
|
by: Nancy |
last post by:
I have two tables:
TblCourse
CourseID
CourseName
TblClass
ClassID
CourseID
ClassDate
|
by: Hannu |
last post by:
Hi.
In the ldb file you can see the users of the mdb-file. If you open the
mdb-file your machine and username will be written in the lbd- file.
Allthough you close the mdb-file your name won't...
|
by: Terry E Dow |
last post by:
Howdy,
I am having trouble with the objectCategory=group member.Count attribute.
I get one of three counts, a number between 1-999, no member (does not
contain member property), or 0. Using...
|
by: Daniel Walzenbach |
last post by:
Hi,
I have a web application which sometimes throws an “out of memory”
exception. To get an idea what happens I traced some values using performance
monitor and got the following values (for...
|
by: renahkw |
last post by:
How can I easily limit the amount of rows displayed in a table, and then navigate from page to page? Each row consists of 3 cells: the first, containing a varying number of images followed by some...
|
by: new2asp |
last post by:
I am new to ASP, and I am trying to figure out how to create a
registration form that can limit that amount of people who are signing
up for an event. The form has to take in consideration the...
|
by: scolivas |
last post by:
Hi to all...I am playing around with a voting database and was wondering if anyone could give me some ideas.
I want to make it so that no one person can vote more than once. No matter how many...
|
by: DAHMB |
last post by:
I have a column in a report that I want to return a sum of certain criteria from a query between two dates. I set the dates in a form that I launch the report from.
My query contains a field called...
|
by: orsula |
last post by:
Hi Guys,
I have a class A composed of several string and int members.
I would like to manage a huge amount (several thousands) of A objects
in a dictionary where each object has its unique key....
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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: 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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |