|
Home > Archive > IIS ASP > May 2005 > help with the loop pls
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
help with the loop pls
|
|
| ptrlks 2005-05-23, 8:00 am |
| 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[/CODE]
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
| |
| Bob Barrows [MVP] 2005-05-23, 8:00 am |
| 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"
| |
| ptr lks 2005-05-23, 8:00 am |
|
the symptom is: that it stops the output where
dTempDate = dStartDate
*** Sent via Developersdex http://www.codecomments.com ***
| |
| Bob Barrows [MVP] 2005-05-23, 8:00 am |
| 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"
| |
| ptrlks 2005-05-24, 6:03 pm |
| "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message news:<#brGue4XFHA.3096@TK2MSFTNGP15.phx.gbl>...
> ptr lks wrote:
> 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/s...kalender115.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/s...kalender115.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?
|
|
|
|
|