Can no one help me with this...please

Results 1 to 5 of 5

Thread: Can no one help me with this...please

  1. #1
    Join Date
    Dec 1969
    Posts
    214

    Default Can no one help me with this...please

    I&#039;m going mad and I&#039;m seriously running out of time. I don&#039;t understand why rs("nEvent") won&#039;t display more then once if<BR>"i" isn&#039;t equal to "j".<BR><BR>Is there another way I could do it?<BR><BR>My code: <BR>&#039;create rows going from 07:00 to 22:00 <BR>for nhour = 8 to 22 <BR>if nhour &#060; 10 then <BR>strnhour = "0" & nhour & ":00" <BR>else <BR>strnhour = nhour& ":00" <BR>end if <BR><BR>%&#062; <BR>&#060;table width="100%" border="0" cellpadding="2" cellspacing="1"&#062; <BR>&#060;tr&#062; <BR>&#060;td width="50" bgcolor="#D6CFBD"&#062;&#060;span class="VerdanaSmall"&#062;&#060;%=strnhour%&#062;& #060;/span&#062; &#060;img src="Images/addEvent.gif"&#062;&#060;/td&#062; <BR>&#060;td width="500"&#062; <BR><BR>&#060;% <BR>if not rs.Eof Then <BR>do while not rs.Eof <BR><BR>j = rs("nTime") <BR>i = rs("nhour") <BR><BR>nTime = i <BR>if nTime &#060; 10 then <BR>strnTime = "0" & i & ":00" <BR>else <BR>strnTime = i& ":00" <BR>end if <BR><BR>if strnTime &#060;&#062; strnhour then exit do <BR>response.write""&rs("nEvent")&"" <BR>rs.movenext <BR>if i&#060;&#062;j then i = i + 1 <BR>if rs.Eof then exit do <BR>loop <BR>end if <BR><BR>%&#062; <BR>&#060;/td&#062; <BR>&#060;td width="7" bgcolor="#9EAFC9"&#062;&#060;/td&#062; <BR>&#060;/tr&#062; <BR>&#060;/table&#062; <BR>&#060;% <BR>next <BR>%&#062; <BR><BR>The line of code " if not i = j then i = i + 1" should add a 1 <BR>to the variable strnTime which should in turn write out <BR>rs("nEvent") until i = j. <BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    7,686

    Default RE: Can no one help me with this...please

    I have no idea what you&#039;re trying to do, but my guess is the problem is in your method of comparing time.<BR><BR>Your times are all strings, so 01:00 &#060; 11:00.<BR><BR>Maybe it&#039;s a good idea to explain a bit more of what you&#039;re trying to do, and how you get this data in the first place.

  3. #3
    Join Date
    Dec 1969
    Posts
    84

    Default Don't consider this as an answer

    But i can&#039;t create a table right now to use your recordset statements,and so commented it out.Then i ommented out an exit do from ur code,and ran ur code.It does the looping.Does that tell u something?<BR><BR>Here is what i did..&#060;%<BR>for nhour = 8 to 22 <BR>if nhour &#060; 10 then <BR>strnhour = "0" & nhour & ":00" <BR>else <BR>strnhour = nhour& ":00" <BR>end if <BR><BR>%&#062; <BR>&#060;table width="100%" border="0" cellpadding="2" cellspacing="1"&#062; <BR>&#060;tr&#062; <BR>&#060;td width="50" bgcolor="#D6CFBD"&#062;&#060;span class="VerdanaSmall"&#062;&#060;%=strnhour%&#062;& #060;/span&#062; &#060;img src="Images/addEvent.gif"&#062;&#060;/td&#062; <BR>&#060;td width="500"&#062; <BR><BR>&#060;% <BR>&#039;if not rs.Eof Then <BR>&#039;do while not rs.Eof <BR>&#039;<BR>j = 1 &#039;rs("nTime") <BR>i = 2 &#039;rs("nhour") <BR><BR>nTime = i <BR>if nTime &#060; 10 then <BR>strnTime = "0" & i & ":00" <BR>else <BR>strnTime = i& ":00" <BR>end if <BR><BR>if strnTime &#060;&#062; strnhour then &#039;exit do <BR>response.write""&"rs(nEvent)"&"" <BR>&#039;rs.movenext <BR>if i&#060;&#062;j then i = i + 1 <BR>&#039;if rs.Eof then exit do <BR>&#039;loop <BR>end if <BR><BR>%&#062; <BR>&#060;/td&#062; <BR>&#060;td width="7" bgcolor="#9EAFC9"&#062;&#060;/td&#062; <BR>&#060;/tr&#062; <BR>&#060;/table&#062; <BR>&#060;% <BR>next <BR>%&#062; <BR><BR><BR>Just try this out.Hope this helps you in finding the real problem.<BR><BR>faustine<BR>--------<BR>

  4. #4
    Join Date
    Dec 1969
    Posts
    214

    Default RE: this is what I'm trying to do...

    Well what I&#039;m trying to do is build an html table with rows going from 07:00 to 22:00.<BR><BR>I did this with a for..to statement<BR>ie: for nhour=7 to 22<BR>and then i gave the numbers a time appearence ending up with strnhour<BR><BR>I&#039;m also getting records from a database,<BR>rs("nhour") and rs("nTime"). rs("nhour") will always be a smaller number then rs("nTime").<BR><BR>variable i is equal to rs("nhour") and varibale j is equal to rs("nTime")<BR><BR>varibale ntime is equal to i and I make the number look like time and end up with strntime<BR><BR>I then compare strntime to strnhour and if it&#039;s equal it displays<BR>the record nEvent also from the database.<BR><BR>This all works fine but what i want it to do next is continue wrîtting out nEvent until varible i is equal to varible j.<BR><BR>The whole picture is I&#039;ve built a calendar and when you click on a date then you get this table from 07:00 hours to 22:00 hours<BR>with the event next to the time that it compares with. The event has an end time which is "j" and I want to to continue to write the event until "j" has been reached.<BR>


  5. #5
    Join Date
    Dec 1969
    Posts
    18,177

    Default Claire! Stick to a single thread. (eop)

    .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •