473,386 Members | 1,969 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,386 software developers and data experts.

help with the loop pls

Hi again,

the problem is in this code:
Expand|Select|Wrap|Line Numbers
  1. ElseIf Right(rsBokad("aktivitet"),
  2. 3) = "Cup" Then
  3.  
  4. dStartDate = Cdate(rsBokad("startDatum"))
  5.  
  6. dEndDate = Cdate(rsBokad("endDatum"))
  7.  
  8. For dTempDate = dStartDate to dEndDate
  9.  
  10. If cint(manad) = Month(dTempDate) AND iDag = Day(dTempDate) then
  11.  
  12. Response.Write "</FONT></B></TD><TD CLASS=""tdcal""
  13. VALIGN=""BOTTOM"">" & rsBokad("aktivitet")
  14.  
  15. Response.Write ", i " & rsBokad("lokal")
  16.  
  17. End If
  18.  
  19. Next
  20.  
  21. ElseIf Right(rsBokad("aktivitet"), 3) = "Cam" Then
  22.  
  23. dStartDate = Cdate(rsBokad("startDatum"))
  24.  
  25. dEndDate = Cdate(rsBokad("endDatum"))
  26.  
  27. For dTempDate = dStartDate to dEndDate
  28.  
  29. If cint(manad) = Month(dTempDate) AND iDag = Day(dTempDate) then
  30.  
  31. Response.Write "</FONT></B></TD><TD CLASS=""tdcal""
  32. VALIGN=""BOTTOM"">" & rsBokad("aktivitet")
  33.  
  34. Response.Write ", i " & rsBokad("lokal")
  35.  
  36. End If
  37.  
  38. 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
Jul 22 '05 #1
4 1432
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"
Jul 22 '05 #2

the symptom is: that it stops the output where
dTempDate = dStartDate
*** Sent via Developersdex http://www.developersdex.com ***
Jul 22 '05 #3
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"
Jul 22 '05 #4
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message news:<#b**************@TK2MSFTNGP15.phx.gbl>...
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?
Jul 22 '05 #5

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

Similar topics

3
by: William Buchanan | last post by:
Hi I have the following stored proc in interbase (which might contain errors - i'm doing it off the top of my head), which I would like to convert into oracle. Can you help? What I want back is...
1
by: nightsaber | last post by:
<script language="JavaScript"> <!-- hide me var the_number = prompt("how many words (3-5 is good)?", "4"); var the_string = ""; var a_word; for (loop = 0; loop < the_number; loop++) {...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
1
by: al2004 | last post by:
Write a program that reads information about youth soccer teams from a file, calculates the average score for each team and prints the averages in a neatly formatted table along with the team name....
1
by: trunxnirvana007 | last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"' 'UPGRADE_WARNING: Couldn't resolve...
9
by: TF | last post by:
Hello all, I made a ASP.NET 2.0 site that shows possible "recipes" for paint colors stored in an access dbase. Basically, 1000 colors are stored with specific RGB values in separate columns. A...
6
by: jenipriya | last post by:
Hi all... its very urgent.. please........i m a beginner in oracle.... Anyone please help me wit dese codes i hv tried... and correct the errors... The table structures i hav Employee (EmpID,...
0
by: shrik | last post by:
I have following error : Total giant files in replay configuration file are : File name : /new_file/prob1.rec Given file /new_file/prob1.rec is successfully verified. Splitting for giant file...
41
by: c | last post by:
Hi every one, Me and my Cousin were talking about C and C#, I love C and he loves C#..and were talking C is ...blah blah...C# is Blah Blah ...etc and then we decided to write a program that...
1
by: mshroom12 | last post by:
Hello to all. I am having difficulty trying to do this Java project using Eclipse. The following is what I have to do. Election Day It's almost election day and the election officials need a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.