473,574 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

looping problem

I am trying to loop through my database to display a picture. That is
no problem. Where I hit a snag is this. I only want three pictures
then break to a new row and three more, etc. Any ideas?
What this does is display one record. Any Help would be appreciated
Below is my code.

<%
strSQL="SELECT DISTINCT Kids.kids_Id AS Kids, kids_pics.kids_ ID AS
kids_pics_kids_ ID,pic_name,fir st_Name,kids_De sc,kids_Age FROM Kids
INNER JOIN kids_pics ON Kids.kids_Id = kids_pics.kids_ ID "
Set rsk = CreateObject("A DODB.Recordset" )
rsk.Open strSQL, con, adOpenStatic, adLockReadOnly
%>

<h1>Waiting Children</h1>

<%
count=count+1
if rsk.eof then error
if not rsk.eof and count>=3 then
count=0%>error
<%else%>
<table border="0" cellspacing="0" cellpadding="0" >
<tr>
<td align="center" width="81"><img src="images/kids_photos/<
%=rsk("pic_name ")%>" alt="Featured Child" /></td>
</tr>
<tr>
<td align="center" width="81"><%=r sk("first_Name" )%></td>
</tr></table>
<%end if%>

Jun 6 '07 #1
2 1741
"Billy Barth" <bj******@gmail .comwrote in message
news:11******** **************@ i38g2000prf.goo glegroups.com.. .
>I am trying to loop through my database to display a picture. That is
no problem. Where I hit a snag is this. I only want three pictures
then break to a new row and three more, etc. Any ideas?
What this does is display one record. Any Help would be appreciated
Below is my code.

<%
strSQL="SELECT DISTINCT Kids.kids_Id AS Kids, kids_pics.kids_ ID AS
kids_pics_kids_ ID,pic_name,fir st_Name,kids_De sc,kids_Age FROM Kids
INNER JOIN kids_pics ON Kids.kids_Id = kids_pics.kids_ ID "
Set rsk = CreateObject("A DODB.Recordset" )
rsk.Open strSQL, con, adOpenStatic, adLockReadOnly
%>

<h1>Waiting Children</h1>

<%
count=count+1
if rsk.eof then error
if not rsk.eof and count>=3 then
count=0%>error
<%else%>
<table border="0" cellspacing="0" cellpadding="0" >
<tr>
<td align="center" width="81"><img src="images/kids_photos/<
%=rsk("pic_name ")%>" alt="Featured Child" /></td>
</tr>
<tr>
<td align="center" width="81"><%=r sk("first_Name" )%></td>
</tr></table>
<%end if%>
Personally I avoid mixing html and .asp too much. , I find it confusing and
prefer to use response.write. Anyway, I don't see a loop in your code
anywhere. Do something like

count=0
do while not rsk.eof
count=count+1
if count = 3 then
count =0
'insert a line break or whatever
end if
'write out your stuff
loop

rsk.close

John Blessing
jo***********@L besoftware.com
http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.room-booking-software.com - Schedule rooms & equipment bookings
for your meeting/class over the web.
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook

Jun 6 '07 #2
On Jun 6, 5:08 pm, "John Blessing" <blessij@**REMO VE**THIS**gmail .com>
wrote:
"Billy Barth" <bj.ba...@gmail .comwrote in message

news:11******** **************@ i38g2000prf.goo glegroups.com.. .


I am trying to loop through my database to display a picture. That is
no problem. Where I hit a snag is this. I only want three pictures
then break to a new row and three more, etc. Any ideas?
What this does is display one record. Any Help would be appreciated
Below is my code.
<%
strSQL="SELECT DISTINCT Kids.kids_Id AS Kids, kids_pics.kids_ ID AS
kids_pics_kids_ ID,pic_name,fir st_Name,kids_De sc,kids_Age FROM Kids
INNER JOIN kids_pics ON Kids.kids_Id = kids_pics.kids_ ID "
Set rsk = CreateObject("A DODB.Recordset" )
rsk.Open strSQL, con, adOpenStatic, adLockReadOnly
%>
<h1>Waiting Children</h1>
<%
count=count+1
if rsk.eof then error
if not rsk.eof and count>=3 then
count=0%>error
<%else%>
<table border="0" cellspacing="0" cellpadding="0" >
<tr>
<td align="center" width="81"><img src="images/kids_photos/<
%=rsk("pic_name ")%>" alt="Featured Child" /></td>
</tr>
<tr>
<td align="center" width="81"><%=r sk("first_Name" )%></td>
</tr></table>
<%end if%>

Personally I avoid mixing html and .asp too much. , I find it confusing and
prefer to use response.write. Anyway, I don't see a loop in your code
anywhere. Do something like

count=0
do while not rsk.eof
count=count+1
if count = 3 then
count =0
'insert a line break or whatever
end if
'write out your stuff
loop

rsk.close

John Blessing
john.bless...@L besoftware.comh ttp://www.LbeHelpdesk .com- Help Desk software priced to suit all
businesseshttp://www.room-booking-software.com- Schedule rooms & equipment bookings
for your meeting/class over the web.http://www.lbetoolbox.com- Remove Duplicates from MS Outlook- Hide quoted text -

- Show quoted text -
Worked. thank you very much.

Jun 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
2597
by: Lyle Fairfield | last post by:
The stored procedure script below is an example of how looping, case statements and output parameters can be used in MS-SQL stored procedures to accomplish things for which we may have had to use VBA code, or automation, in the JET world. Some who have not yet worked with MS-SQL may be interested. The script is indented in reality but I have...
7
5462
by: Ken | last post by:
Hi All - I have a filtered GridView. This GridView has a check box in the first column. This check box is used to identify specific rows for delete operations. On the button click event I loop through the filtered GridView to identify the selected rows and assemble some XML to be sent to a stored proc. The problem I have is that when...
13
5006
by: JayCallas | last post by:
I know this question has been asked. And the usual answer is don't use cursors or any other looping method. Instead, try to find a solution that uses set-based queries. But this brings up several questions / senarios: * I created several stored procedures that take parameters and inserts the data into the appropriate tables. This was done...
5
1479
by: Jeff | last post by:
Hey gang. I have a script that gets stats from a mssql db, and then inserts those stats into a temp table. where i can work with them as i wish. the problem is it isn't looping through all the records, and i am not sure why. i know the script isn't perfect, as it is open to sql injection and stuff like that, but once the site is...
6
1809
by: Luke - eat.lemons | last post by:
Hi, Im pretty new to asp so all light on this question would be great. Basically i need to test to see what value is set (where to retrieve the data from) so ive done it like this: If Request.Querystring("id") = "" then TidF=Request.Form("TidF") Else
1
1843
by: assgar | last post by:
Hello I have changed the process code abit so it receives the data from the form and ensures the data in array format. This has eliminated my previous error. The problem I am experiencing is the looping is not displaying the all contents of the arrays. Do you have any idea what the problem is and how to fix the problem?
3
3715
by: Andy | last post by:
Hello, I have the following situation: Thread A is allocating a dataset, doing some low-level calculations and storing a pointer to the dataset in a std::list via push_back. Thread B should retrieve the pointer to the first dataset in the list, remove it from the list, and do some high level analysis. The problem now is, how do I...
3
1896
by: assgar | last post by:
Hi I am having problem with my loping. I don't know if I have chosen the correct approach. GOAL: I need to insert into a table event types for a specific date range. The calendar the event type is displayed on is divided into 15 minutes time intervals
3
1944
by: chiku1523 | last post by:
Hi, Please find the following code. In function setAnswers, I am looping with each question. I have inner loop, which is looping for each answers of the questions. If any of the answer for question 1 and question2 is selected this code is working fine. But if None of answer of either question selected, it is not iterating through outer loop....
1
1989
by: Robocop | last post by:
Having just started using C again after some years off, i've been stumped by a problem i think someone more experienced could probably solve pretty easily. I have these 4 objects (vectors), and i want to find a combination of these 4 objects into two pairs, where the sum of a specific attribute of each vector in each pair comes closest to...
0
7720
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8044
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7810
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8096
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5618
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5299
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2240
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1337
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1056
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.