Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: How to control display of recordset result in table/Calender


Message #1 by "David Yee" <david@r...> on Sat, 27 Oct 2001 15:43:27 +0800
May i know how can i control the position/column of the record to

be display from my recordet.



I need to display my results from the recordset on a table of 3 rows and 7

columns

which a row is used to represents a week. I am able to figure out the column

to start

displaying the record using the Weekday() function. However i am stuck with

how to

display it on the first row as well as displaying into the 2 and 3 rows of

the table.



Please advice me on this... Thank you..





For for the first row, i use



Response.Write "<tr>"

   For i = 1 to (Weekday(date) - 1)

      Response.Write "<td> &nbsp; </td>"

   Next



While Not RS.EOF

   For j = Weekday(date) to 7

      Response.Write "<td> </td>" & _

      RS.MoveNext

   Next

WEnd

REsponse.Write "</tr>"



Message #2 by "Ken Schaefer" <ken@a...> on Mon, 29 Oct 2001 12:12:32 +1100
Here is some generic advice:



Write your logic out onto a piece of paper...



"We need to loop through the HTML table. For each cell in the HTML table we

need to loop through the array, and compare x to y. If x = y then we do "a".

If x <> y then we do "b". If x = 7 then we need to finish the HTML row and

start another one". etc



Once you have this "use case" worked out, then you can easily write the

necessary VBScript conditional logic. You run into problems when you start

writing out code without understanding fully what you're trying to do first.



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----- Original Message -----

From: "David Yee" <david@r...>

To: "ASP Web HowTo" <asp_web_howto@p...>

Sent: Saturday, October 27, 2001 6:43 PM

Subject: [asp_web_howto] How to control display of recordset result in

table/Calender





: May i know how can i control the position/column of the record to

: be display from my recordet.

:

: I need to display my results from the recordset on a table of 3 rows and 7

: columns

: which a row is used to represents a week. I am able to figure out the

column

: to start

: displaying the record using the Weekday() function. However i am stuck

with

: how to

: display it on the first row as well as displaying into the 2 and 3 rows of

: the table.

:

: Please advice me on this... Thank you..

:

:

: For for the first row, i use

:

: Response.Write "<tr>"

:    For i = 1 to (Weekday(date) - 1)

:       Response.Write "<td> &nbsp; </td>"

:    Next

:

: While Not RS.EOF

:    For j = Weekday(date) to 7

:       Response.Write "<td> </td>" & _

:       RS.MoveNext

:    Next

: WEnd

: REsponse.Write "</tr>"





Message #3 by "H. Carter Harris" <carter@t...> on Mon, 25 Sep 2000 07:27:50 -0500
Well stated Ken.  I see so much crap written these days because someone

started writing code before they had a clear understanding of what the logic

should be.



-----Original Message-----

From: Ken Schaefer [mailto:ken@a...]

Sent: Sunday, October 28, 2001 7:13 PM

To: ASP Web HowTo

Subject: [asp_web_howto] Re: How to control display of recordset result

in table/Calender





Here is some generic advice:



Write your logic out onto a piece of paper...



"We need to loop through the HTML table. For each cell in the HTML table we

need to loop through the array, and compare x to y. If x = y then we do "a".

If x <> y then we do "b". If x = 7 then we need to finish the HTML row and

start another one". etc



Once you have this "use case" worked out, then you can easily write the

necessary VBScript conditional logic. You run into problems when you start

writing out code without understanding fully what you're trying to do first.



Cheers

Ken

  Return to Index