Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Displaying Recordset in Multi Column table


Message #1 by "Andrew Matheson" <amatheso@y...> on Sat, 10 Aug 2002 15:28:54
G'day,

I have a table in my DB with say 50 Records.  What asp code do i need in 
order to have each record spread over different columns in a table.

I.E If i People names in the table, how would i use asp / html to display 
as folows:

       ---------------------------------------------------
       | First Name | Last Name | First Name | Last Name |
       | -------------------------------------------------
       | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
       | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
       | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
       | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
       | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
       ---------------------------------------------------

Any help is appreciated

Regards

Andrew
Message #2 by "Ian Richardson" <ian@i...> on Sat, 10 Aug 2002 15:27:32 +0100
Hi, Have a look at:
http://www.4guysfromrolla.com/webtech/102299-1.shtml

should be a good starting point.

cheers

ian
----- Original Message -----
From: "Andrew Matheson" <amatheso@y...>
To: "Access ASP" <access_asp@p...>
Sent: Saturday, August 10, 2002 3:28 PM
Subject: [access_asp] Displaying Recordset in Multi Column table


> G'day,
>
> I have a table in my DB with say 50 Records.  What asp code do i need in
> order to have each record spread over different columns in a table.
>
> I.E If i People names in the table, how would i use asp / html to display
> as folows:
>
>        ---------------------------------------------------
>        | First Name | Last Name | First Name | Last Name |
>        | -------------------------------------------------
>        | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
>        | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
>        | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
>        | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
>        | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
>        ---------------------------------------------------
>
> Any help is appreciated
>
> Regards
>
> Andrew
>

Message #3 by "Chetan Kelkar" <chetan@c...> on Mon, 12 Aug 2002 08:54:30 +0530
hello andrew,

as far as i understand your query, u are getting certain records for the db
using asp. you can simply loop thru the records like this

**( i have assumed that you already have retrieved the records and filled it
in rs)**

<TABLE WIDTH=75% BORDER=1 CELLSPACING=1 CELLPADDING=1>
 <TR>
  <TD>First Name</TD>
  <TD>Last Name</TD>
  <TD>|</TD>
  <TD>First Name</TD>
  <TD>Last Name</TD>
 </TR>
</TABLE>

<%
do while not rs.eof
Response.Write ("<TR>")
Response.Write ("<TD>" & rs("firstname") & "</TD>")
Response.Write ("<TD>" & rs("lastname") & "</TD>")
rs.movenext
Response.Write ("<TD>" & rs("firstname") & "</TD>")
Response.Write ("<TD>" & rs("lastname") & "</TD>")
Response.Write ("</TR>")
rs.movenext
loop

hope this helps
chetan
----- Original Message -----
From: "Andrew Matheson" <amatheso@y...>
To: "Access ASP" <access_asp@p...>
Sent: Saturday, August 10, 2002 3:28 PM
Subject: [access_asp] Displaying Recordset in Multi Column table


> G'day,
>
> I have a table in my DB with say 50 Records.  What asp code do i need in
> order to have each record spread over different columns in a table.
>
> I.E If i People names in the table, how would i use asp / html to display
> as folows:
>
>        ---------------------------------------------------
>        | First Name | Last Name | First Name | Last Name |
>        | -------------------------------------------------
>        | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
>        | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
>        | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
>        | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
>        | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
>        ---------------------------------------------------
>
> Any help is appreciated
>
> Regards
>
> Andrew
>

Message #4 by "Andrew Matheson" <amatheso@y...> on Tue, 13 Aug 2002 02:51:48
Hi Again.

Thanks for your replies.  They appear to work fine.  I am now just 
wondering how i can get alpa sorting i each column.  

Bot solutions are sorted as:

        ---------------------------------------------------
        | First Name | Last Name | First Name | Last Name |
        | -------------------------------------------------
        | AAAAAAAA   | BBBBBBB   | CCCCCCC    | DDDDDDD   |
        | EEEEEEE    | FFFFFFF   | GGGGGGG    | HHHHHHH   |
        | IIIIIII    | JJJJJJJ   | KKKKKKK    | LLLLLLL   |
        ---------------------------------------------------

Can i sort it so it appears as:


        ---------------------------------------------------
        | First Name | Last Name | First Name | Last Name |
        | -------------------------------------------------
        | AAAAAAAA   | DDDDDDD   | GGGGGGG    | JJJJJJJ   |
        | BBBBBBB    | EEEEEEE   | HHHHHHH    | KKKKKKK   |
        | CCCCCCC    | FFFFFFF   | IIIIIII    | LLLLLLL   |
        ---------------------------------------------------

Thanks

Andrew



> G'day,

> I have a table in my DB with say 50 Records.  What asp code do i need in 
o> rder to have each record spread over different columns in a table.

> I.E If i People names in the table, how would i use asp / html to 
display 
a> s folows:

>        ---------------------------------------------------
 >       | First Name | Last Name | First Name | Last Name |
 >       | -------------------------------------------------
 >       | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
 >       | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
 >       | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
 >       | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
 >       | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
 >       ---------------------------------------------------

> Any help is appreciated

> Regards

> Andrew
Message #5 by "Ken Schaefer" <ken@a...> on Tue, 13 Aug 2002 12:58:15 +1000
This is just simple logic.

Write the logic out on a piece of paper, then write your code.

a) In SQL, you can only sort the whole recordset, so sort it A-Z

b) In your ASP page you want to start at record 1 in column 1, and you want
to start at record Int(N/2) + 1 in column 2, where N is the number of
records. Use a function like .GetRows to get your records into an array so
you can work out how many records you have:

If not objRS.EOF then
    arrResults = objRS.GetRows
End If
.
.
If isArray(arrResults) then
    intNumRecords = UBound(arrResults, 2) + 1
    If intNumRecords MOD 2 = 1 then
        intHalfWay = Int(intNumRecords/2) + 2
    Else
        intHalfWay = intNumRecords/2 + 1
    End If

    .
    .
End If

Now, You start writing at record 1 in the first column, and at record
intHalfWay in the second column



Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Andrew Matheson" <amatheso@y...>
Subject: [access_asp] Re: Displaying Recordset in Multi Column table


: Hi Again.
:
: Thanks for your replies.  They appear to work fine.  I am now just
: wondering how i can get alpa sorting i each column.
:
: Bot solutions are sorted as:
:
:         ---------------------------------------------------
:         | First Name | Last Name | First Name | Last Name |
:         | -------------------------------------------------
:         | AAAAAAAA   | BBBBBBB   | CCCCCCC    | DDDDDDD   |
:         | EEEEEEE    | FFFFFFF   | GGGGGGG    | HHHHHHH   |
:         | IIIIIII    | JJJJJJJ   | KKKKKKK    | LLLLLLL   |
:         ---------------------------------------------------
:
: Can i sort it so it appears as:
:
:
:         ---------------------------------------------------
:         | First Name | Last Name | First Name | Last Name |
:         | -------------------------------------------------
:         | AAAAAAAA   | DDDDDDD   | GGGGGGG    | JJJJJJJ   |
:         | BBBBBBB    | EEEEEEE   | HHHHHHH    | KKKKKKK   |
:         | CCCCCCC    | FFFFFFF   | IIIIIII    | LLLLLLL   |
:         ---------------------------------------------------
:
: Thanks
:
: Andrew
:
:
:
: > G'day,
:
: > I have a table in my DB with say 50 Records.  What asp code do i need in
: o> rder to have each record spread over different columns in a table.
:
: > I.E If i People names in the table, how would i use asp / html to
: display
: a> s folows:
:
: >        ---------------------------------------------------
:  >       | First Name | Last Name | First Name | Last Name |
:  >       | -------------------------------------------------
:  >       | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
:  >       | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
:  >       | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
:  >       | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
:  >       | XXXXXXX    | XXXXXXX   | XXXXXXX    | XXXXXXX   |
:  >       ---------------------------------------------------
:
: > Any help is appreciated
:
: > Regards
:
: > Andrew

Message #6 by "Daniel Groh" <daniel.groh@s...> on Tue, 13 Aug 2002 08:42:41 -0300
Sorry, I didn't understand...

Could you explain me again?

What do you want to do?

Hugs

Daniel


  Return to Index