473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Need to come Out Of DO loop when my recordset gets empty

Ok here is my Problem.

I am trying to place some data from my recordset onto the page ,
Just 4 in a row and next four should come in second line
But the problem is my recordset gets empty befor the end of my second line and i get

error '80020009'
/asp/index.asp, line 229


The code is as follows

<table width="450" cellpadding="2" cellspacing="2">
<% '=-=--=-=-=-=-=-=-=-=-===-==-==-=-==-=-=-=-=-=-=-=-=-=-
Do While Not rsSponsor.EOF
'-=-=-=-=-=-=-=-==-===-=-=-=-=-=-=-=-=-=-=-=--=-=-=-==-=-=%>
<tr>
<td width="100">
<%
If rsSponsor.EOF Then
rsSponsor.Close
Else
rsSponsor.MoveNext
End If
Response.write("<a href =" & rsSponsor("Sponser_Link") &" target= blank>")
Response.write("<img border = '0' src = images_sponsors/" & rsSponsor("Sponser_Logo") &">")
Response.write("</a>")
%>
</td>
<%
If rsSponsor.EOF Then
rsSponsor.Close
Else
rsSponsor.MoveNext
End If
%>
<td width="100">
<%
Response.write("<a href =" & rsSponsor("Sponser_Link") &" target= blank>")
Response.write("<img border = '0' src = images_sponsors/" & rsSponsor("Sponser_Logo") &">")
Response.write("</a>")
%>
</td>
<%
If rsSponsor.EOF Then
rsSponsor.Close
Else
rsSponsor.MoveNext
End If
%>
<td width="100">
<%
Response.write("<a href =" & rsSponsor("Sponser_Link") &" target= blank>")
Response.write("<img border = '0' src = images_sponsors/" & rsSponsor("Sponser_Logo") &">")
Response.write("</a>")
%>
</td>
<%
If rsSponsor.EOF Then
rsSponsor.Close
Else
rsSponsor.MoveNext
End If
%>
<td width="100">
<%
Response.write("<a href =" & rsSponsor("Sponser_Link") &" target= blank>")
Response.write("<img border = '0' src = images_sponsors/" & rsSponsor("Sponser_Logo") &">")
Response.write("</a>")
%>
</td>
<%
If rsSponsor.EOF Then
rsSponsor.Close
Else
rsSponsor.MoveNext
End If
%>
</tr>
<%
Loop
%>
</table>
Apr 5 '07 #1
2 1173
jhardman
3,406 Expert 2GB
try:
Expand|Select|Wrap|Line Numbers
  1. If rsSponsor.EOF Then
  2.    exit do
or is it "exit loop"? One of the two.

the better way would be to run through the loop just once per record, instead of once per four records and keep a running count of how many records you have on that line:
Expand|Select|Wrap|Line Numbers
  1. i = i + 1
  2. if i = 4 then
  3.    'I already have four on this line
  4.    response.write "</tr><tr>"
  5.    i = 0
  6. end if
For every record the counter i is increased by one until it reaches 4, then the counter is reset and the new row is started.

Let me know if this helps.

Jared
Apr 10 '07 #2
iam_clint
1,208 Expert 1GB
don't even use do

while not rs.eof

rs.movenext
wend
Apr 10 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Glenn Profitt | last post by:
Hi, I am using a text box as the subject for an invoice email. The textbox works fine for listing individual fields from the tblOrders table as shown below: ="Hi, " & & " " & "Your order is...
106
by: xtra | last post by:
Hi Folk I have about 1000 procedures in my project. Many, many of them are along the lines of function myfuntion () as boolean on error goto er '- Dim Dbs as dao.database Dim Rst as...
2
by: Keith Kowalski | last post by:
I anm opening up a text file reading the lines of the file that refer to a tif image in that file, If the tif image does not exist I need it to send an email stating that the file doesn't exist...
1
by: jdurden | last post by:
am currently woking on building this site: www.maverick-spirit.com. everything seems to be fine except the press releases page. When you click on one of the press releases in the left column under...
3
by: sunbeam | last post by:
Short Description of the Project: we developed a e-learning system for our students. each student has a unique username/password to view the modules he/she should view and nothing more. since we...
5
by: Eric Layman | last post by:
Hi, Many years ago when I first learnt abt web dev in school, I was taught this methodology: <html> blah blabh
4
by: ipez75 | last post by:
Hello everyone, I have a web application written in asp 6.0, my problem is that I execute a sql server store procedure and I get an empty recordset, while executing the same sp on query anlyzer I...
1
by: javabeginner123 | last post by:
i have a java prob, and i have to solve it fast, but i'm just getting to know it, so plz help me solve it with full code completed, thanks so much. the prob is to create a monter fight and there is...
8
by: mvdave | last post by:
Hello all & I hope I'm posting in the right place.. I need to load a temporary table with a range of sequential dates, passing it a beginning and an end date from a criteria form. I have...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
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,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.