Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > help with the loop pls

Reply
Thread Tools

help with the loop pls

 
 
ptrlks
Guest
Posts: n/a
 
      05-23-2005
Hi again,



the problem is in this code:
Code:
ElseIf Right(rsBokad("aktivitet"),
3) = "Cup" Then

dStartDate = Cdate(rsBokad("startDatum"))

dEndDate = Cdate(rsBokad("endDatum"))

For dTempDate = dStartDate to dEndDate

If cint(manad) = Month(dTempDate) AND iDag = Day(dTempDate) then

Response.Write "</FONT></B></TD><TD CLASS=""tdcal""
VALIGN=""BOTTOM"">" & rsBokad("aktivitet")

Response.Write ", i " & rsBokad("lokal")

End If

Next

ElseIf Right(rsBokad("aktivitet"), 3) = "Cam" Then

dStartDate = Cdate(rsBokad("startDatum"))

dEndDate = Cdate(rsBokad("endDatum"))

For dTempDate = dStartDate to dEndDate

If cint(manad) = Month(dTempDate) AND iDag = Day(dTempDate) then

Response.Write "</FONT></B></TD><TD CLASS=""tdcal""
VALIGN=""BOTTOM"">" & rsBokad("aktivitet")

Response.Write ", i " & rsBokad("lokal")

End If

Next
This is what I want to do:

If Right(rsBokad("aktivitet"), 3) = "Cam" Then
if dTempDate = dStartDate
If cint(manad) = Month(dTempDate) AND iDag = Day(dTempDate) then Write
set dTempDate = dStartDate + 1
If cint(manad) = Month(dTempDate) AND iDag = Day(dTempDate) then Write
set dTempDate = dStartDate + 2
If cint(manad) = Month(dTempDate) AND iDag = Day(dTempDate) then Write
Repeat this until dTempDate = dendDate


Being from Sweden I apologize for my English
Thanks in advance
As a NOOB any help we'll be appreciated
/Peter
 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      05-23-2005
ptrlks wrote:
> Hi again,
>
>
>
> the problem is in this code:


What are the symptoms of your problem? Don't make us attempt to run your
code to discover your symptoms.


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"


 
Reply With Quote
 
 
 
 
ptr lks
Guest
Posts: n/a
 
      05-23-2005

the symptom is: that it stops the output where
dTempDate = dStartDate


*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      05-23-2005
ptr lks wrote:
> the symptom is: that it stops the output where
> dTempDate = dStartDate
>

Ah! That helps. I have to go to work now, but I will look at this later and
reply if nobody else has jumped in by then.

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"


 
Reply With Quote
 
ptrlks
Guest
Posts: n/a
 
      05-24-2005
"Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message news:<#(E-Mail Removed)>...
> ptr lks wrote:
> > the symptom is: that it stops the output where
> > dTempDate = dStartDate
> >

> Ah! That helps. I have to go to work now, but I will look at this later and
> reply if nobody else has jumped in by then.
>
> Bob Barrows


Hi, the pages are in swedish, but i hope the still helps you
understand my problems:
this page http://www45.brinkster.com/ovaasp/list.asp uses
<%
Session.LCID = 1053
Set minCon = Server.CreateObject("ADODB.Connection")
set rsBokad = Server.CreateObject("ADODB.Recordset")
minCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("\ovaasp\db\upptaget.mdb")
strSQL =" SELECT * FROM upptaget ORDER by ID ASC"
rsBokad.Open strSQL, minCon, 3, 3

Do While Not rsBokad.EOF
If Left(rsBokad("aktivitet"), 3) = "Trä" Then
Response.Write "<BR>" & rsBokad("startDatum") & " " &
rsBokad("aktivitet") & " "
Response.Write FormatDateTime(rsBokad("startTid"), 4) & " - "
Response.Write FormatDateTime(rsBokad("endTid"),4) & ", " &
rsBokad("lokal") & "<BR>"
ElseIf Left(rsBokad("aktivitet"), 2) = "Ma" Then
Response.Write "<P>" & rsBokad("startDatum") & " " &
rsBokad("aktivitet") & " mot "
Response.Write rsBokad("Mot") & " i " & rsBokad("lokal") & ", kl "
Response.Write FormatDateTime(rsBokad("startTid"), 4) & "<P>"
ElseIf Right(rsBokad("aktivitet"), 3) = "Cup" Then
dStartDate = Cdate(rsBokad("startDatum"))
dEndDate = Cdate(rsBokad("endDatum"))
For dTempDate = dStartDate to dEndDate
Response.Write "<P>" & dTempDate & " " & rsBokad("aktivitet") & " i
"
Response.Write rsBokad("lokal") & "<BR>"
Next
ElseIf Right(rsBokad("aktivitet"), 3) = "Cam" Then
dStartDate = Cdate(rsBokad("startDatum"))
dEndDate = Cdate(rsBokad("endDatum"))
For dTempDate = dStartDate to dEndDate
Response.Write "<P>" & dTempDate & " " & rsBokad("aktivitet") & " i
"
Response.Write rsBokad("lokal") & "<BR>"
Next
Else
Response.Write rsBokad("startDatum") & " " & rsBokad("aktivitet")
& " i "
Response.Write rsBokad("lokal") & "<BR>"

End if
rsBokad.MoveNext
Loop

rsBokad.Close
Set rsBokad = Nothing
minCon.Close
Set minCon = Nothing
%>
to list contents of a database. As you see occures "Ekens Cup, Solna"
5 times (3 - 7th jun)
Now please
1. visit http://www45.brinkster.com/ovaasp/sk...alender115.asp
2. check "Nästa Månad"
3. press the button "Framåt" and you cames to jun-05
As you see, occurs "Ekens Cup, Solna" only on 3rd of jun and not on 4,
5, 6 and 7th why??
the code for http://www45.brinkster.com/ovaasp/sk...alender115.asp
<%
Response.Write "<CENTER><FONT SIZE =""4""><B>" &
FirstVersal(MonthName(manad)) & ", " & ar & "</B></FONT></CENTER>"
Response.Write "<CENTER><TABLE CLASS=""table"" CELLSPACING=""0""
CELLPADDING=""1"">"
For iDag = 1 to DatePart("d", DateSerial(ar, manad+1, 0))
aDagar(iDag) = WeekDayName(DatePart("w",ar & "-" & manad & "-" &
iDag))
iWeekDay = DatePart("w",ar & "-" & manad & "-" & iDag)
Response.Write "<TR><TD CLASS=""tdleft"" ALIGN=""CENTER""
VALIGN=""BOTTOM""><CENTER><B><FONT SIZE=""5"">"
Response.Write iDag
Response.Write "</FONT></B></CENTER></TD><TD CLASS=""tdnamn""
VALIGN=""BOTTOM"">" & FirstVersal(aDagar(iDag)) & "</TD>"
Set minCon = Server.CreateObject("ADODB.Connection")
set rsBokad = Server.CreateObject("ADODB.Recordset")
minCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("\ovaasp\db\upptaget.mdb")
strSQL = "SELECT * FROM upptaget WHERE month(startDatum) = " & manad &
" AND day(startDatum) = " & iDag & " ORDER by ID ASC"
rsBokad.Open strSQL, minCon, 3, 3
Do While Not rsBokad.EOF
If Left(rsBokad("aktivitet"), 3) = "Trä" then
Response.Write "</FONT></B></TD><TD CLASS=""tdcal""
VALIGN=""BOTTOM"">" & rsBokad("aktivitet")
Response.Write ", kl " & FormatDateTime(rsBokad("startTid"), 4) & "
- "
Response.Write FormatDateTime(rsBokad("endTid"), 4) & " , " &
rsBokad("lokal")
ElseIf Left(rsBokad("aktivitet"), 2) = "Ma" Then
Response.Write "</FONT></B></TD><TD CLASS=""tdcal""
VALIGN=""BOTTOM"">" & rsBokad("aktivitet")
Response.Write " mot " & rsBokad("Mot")
Response.Write " i " & rsBokad("lokal") & ", kl "
Response.Write FormatDateTime(rsBokad("startTid"), 4)
ElseIf Right(rsBokad("aktivitet"), 3) = "Cup" Then
dStartDate = Cdate(rsBokad("startDatum"))
dEndDate = Cdate(rsBokad("endDatum"))
For dTempDate = dStartDate to dEndDate
If cint(manad) = Month(dTempDate) AND iDag = Day(dTempDate) then
Response.Write "</FONT></B></TD><TD CLASS=""tdcal""
VALIGN=""BOTTOM"">" & rsBokad("aktivitet")
Response.Write ", i " & rsBokad("lokal")
End If
Next
ElseIf Right(rsBokad("aktivitet"), 3) = "Cam" Then
dStartDate = Cdate(rsBokad("startDatum"))
dEndDate = Cdate(rsBokad("endDatum"))
For dTempDate = dStartDate to dEndDate
If cint(manad) = Month(dTempDate) AND iDag = Day(dTempDate) then
Response.Write "</FONT></B></TD><TD CLASS=""tdcal""
VALIGN=""BOTTOM"">" & rsBokad("aktivitet")
Response.Write ", i " & rsBokad("lokal")
End If
Next
Else
Response.Write "</FONT></B></TD><TD CLASS=""tdcal""
VALIGN=""BOTTOM"">" & rsBokad("aktivitet")
Response.Write ", i " & rsBokad("lokal")

End if
rsBokad.MoveNext
Loop

rsBokad.Close
Set rsBokad = Nothing
minCon.Close
Set minCon = Nothing
%>So my problem/Q is:
Whu only on the 3rd and not on
4th
5th
6th
7th?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Triple nested loop python (While loop insde of for loop inside ofwhile loop) Isaac Won Python 9 03-04-2013 10:08 AM
URGENT - Pls help...pls recommend - laptop purchase irfansmith@gmail.com Computer Information 2 08-15-2008 11:34 PM
Loop D Loop... Help Tim::.. ASP General 0 05-26-2004 11:21 AM
help: loop within a loop -how to display data in 3 columns by 4 rows format addi ASP General 0 12-31-2003 04:31 AM
pls, help.. i need a number..pls olabanji timothy MCSE 7 09-10-2003 04:02 PM



Advertisments