displaying data in columns

Discussion in 'ASP General' started by Jennifer Smith, Sep 17, 2004.

  1. I want to be able to display my recordset as follows:

    a e
    b f
    c g
    d h

    Instead of :
    a b
    c d
    e f
    g h

    Any links to some examples?
    Jennifer Smith, Sep 17, 2004
    #1
    1. Advertising

  2. Jennifer Smith

    Mark Schupp Guest

    Do you need each piece of data in its own cell?

    If not

    <tr>
    <td>
    list the first column here using <br> or <p> for line breaks
    </td>
    <td>
    list the second column here using <br> or <p> for line breaks
    </td>
    </tr>

    If you do need separate cells put the data into an array (maybe with
    GetRows()) and grab the element you need as you generate the table cells.


    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    www.ielearning.com


    "Jennifer Smith" <> wrote in message
    news:...
    > I want to be able to display my recordset as follows:
    >
    > a e
    > b f
    > c g
    > d h
    >
    > Instead of :
    > a b
    > c d
    > e f
    > g h
    >
    > Any links to some examples?
    >
    Mark Schupp, Sep 17, 2004
    #2
    1. Advertising

  3. Jennifer Smith wrote:
    > I want to be able to display my recordset as follows:
    >
    > a e
    > b f
    > c g
    > d h
    >
    > Instead of :
    > a b
    > c d
    > e f
    > g h
    >
    > Any links to some examples?


    Does this recordset contain two fields? Or does each letter in your example
    represent a row in the recordset?

    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Sep 17, 2004
    #3
  4. Sorry each letter represents a field.

    I need to order my data alphabetically in columns.

    For example - I return a recordset of a, b, c, d

    I would want to display like this:
    col 1 col2
    a c
    c d

    Thanks :)

    "Bob Barrows [MVP]" wrote:

    > Jennifer Smith wrote:
    > > I want to be able to display my recordset as follows:
    > >
    > > a e
    > > b f
    > > c g
    > > d h
    > >
    > > Instead of :
    > > a b
    > > c d
    > > e f
    > > g h
    > >
    > > Any links to some examples?

    >
    > Does this recordset contain two fields? Or does each letter in your example
    > represent a row in the recordset?
    >
    > Bob Barrows
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    Jennifer Smith, Sep 17, 2004
    #4
  5. I'm sorry, I'm still not clear about what your recordset contains. Is it 4
    rows, each row containing a letter?

    field1
    a
    b
    c
    d

    Or is it 2 rows, each row containing two fields?

    field1 field2
    a b
    c d

    Perhaps if you showed us the SQL statement used to generate the recordset,
    all would become clear.

    Bob Barrows
    Jennifer Smith wrote:
    > Sorry each letter represents a field.
    >
    > I need to order my data alphabetically in columns.
    >
    > For example - I return a recordset of a, b, c, d
    >
    > I would want to display like this:
    > col 1 col2
    > a c
    > c d
    >
    > Thanks :)
    >
    > "Bob Barrows [MVP]" wrote:
    >
    >> Jennifer Smith wrote:
    >>> I want to be able to display my recordset as follows:
    >>>
    >>> a e
    >>> b f
    >>> c g
    >>> d h
    >>>
    >>> Instead of :
    >>> a b
    >>> c d
    >>> e f
    >>> g h
    >>>
    >>> Any links to some examples?

    >>
    >> Does this recordset contain two fields? Or does each letter in your
    >> example represent a row in the recordset?
    >>
    >> Bob Barrows
    >> --
    >> Microsoft MVP -- ASP/ASP.NET
    >> Please reply to the newsgroup. The email account listed in my From
    >> header is my spam trap, so I don't check it very often. You will get
    >> a quicker response by posting to the newsgroup.


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Sep 17, 2004
    #5
  6. Sorry I wasn't more clear. It is 4 rows each containing a letter. So 4
    records returned.


    "Bob Barrows [MVP]" wrote:

    > I'm sorry, I'm still not clear about what your recordset contains. Is it 4
    > rows, each row containing a letter?
    >
    > field1
    > a
    > b
    > c
    > d
    >
    > Or is it 2 rows, each row containing two fields?
    >
    > field1 field2
    > a b
    > c d
    >
    > Perhaps if you showed us the SQL statement used to generate the recordset,
    > all would become clear.
    >
    > Bob Barrows
    > Jennifer Smith wrote:
    > > Sorry each letter represents a field.
    > >
    > > I need to order my data alphabetically in columns.
    > >
    > > For example - I return a recordset of a, b, c, d
    > >
    > > I would want to display like this:
    > > col 1 col2
    > > a c
    > > c d
    > >
    > > Thanks :)
    > >
    > > "Bob Barrows [MVP]" wrote:
    > >
    > >> Jennifer Smith wrote:
    > >>> I want to be able to display my recordset as follows:
    > >>>
    > >>> a e
    > >>> b f
    > >>> c g
    > >>> d h
    > >>>
    > >>> Instead of :
    > >>> a b
    > >>> c d
    > >>> e f
    > >>> g h
    > >>>
    > >>> Any links to some examples?
    > >>
    > >> Does this recordset contain two fields? Or does each letter in your
    > >> example represent a row in the recordset?
    > >>
    > >> Bob Barrows
    > >> --
    > >> Microsoft MVP -- ASP/ASP.NET
    > >> Please reply to the newsgroup. The email account listed in my From
    > >> header is my spam trap, so I don't check it very often. You will get
    > >> a quicker response by posting to the newsgroup.

    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    Jennifer Smith, Sep 17, 2004
    #6
  7. I would do something like what Mark said (this is untested and may need to
    be tweaked):

    'open the recordset, then
    arData = rs.GetRows
    rs.close:set rs=nothing
    cn.close:set cn = nothing

    if isarray(arData) then
    'assuming <table> tags are already in place
    for i = 0 to ubound(arData,2)
    if i mod 2 = 1 then '(if it's an even numbered row)
    response.write "<td>" & arData(0,i) & "</td></tr>"
    else
    response.write "<tr><td>" & arData(0,i) & "</td>"
    end if
    next
    if ubound(arData,2) mod 2 = 0 then
    response.write "<td></td></tr>"
    end if
    else
    'handle situation where no data was returned
    end if


    Jennifer Smith wrote:
    > Sorry I wasn't more clear. It is 4 rows each containing a letter.
    > So 4 records returned.
    >
    >
    > "Bob Barrows [MVP]" wrote:
    >
    >> I'm sorry, I'm still not clear about what your recordset contains.
    >> Is it 4 rows, each row containing a letter?
    >>
    >> field1
    >> a
    >> b
    >> c
    >> d
    >>
    >> Or is it 2 rows, each row containing two fields?
    >>
    >> field1 field2
    >> a b
    >> c d
    >>
    >> Perhaps if you showed us the SQL statement used to generate the
    >> recordset, all would become clear.
    >>
    >> Bob Barrows
    >> Jennifer Smith wrote:
    >>> Sorry each letter represents a field.
    >>>
    >>> I need to order my data alphabetically in columns.
    >>>
    >>> For example - I return a recordset of a, b, c, d
    >>>
    >>> I would want to display like this:
    >>> col 1 col2
    >>> a c
    >>> c d
    >>>
    >>> Thanks :)
    >>>
    >>> "Bob Barrows [MVP]" wrote:
    >>>
    >>>> Jennifer Smith wrote:
    >>>>> I want to be able to display my recordset as follows:
    >>>>>
    >>>>> a e
    >>>>> b f
    >>>>> c g
    >>>>> d h
    >>>>>
    >>>>> Instead of :
    >>>>> a b
    >>>>> c d
    >>>>> e f
    >>>>> g h
    >>>>>
    >>>>> Any links to some examples?
    >>>>
    >>>> Does this recordset contain two fields? Or does each letter in your
    >>>> example represent a row in the recordset?
    >>>>
    >>>> Bob Barrows
    >>>> --
    >>>> Microsoft MVP -- ASP/ASP.NET
    >>>> Please reply to the newsgroup. The email account listed in my From
    >>>> header is my spam trap, so I don't check it very often. You will
    >>>> get
    >>>> a quicker response by posting to the newsgroup.

    >>
    >> --
    >> Microsoft MVP -- ASP/ASP.NET
    >> Please reply to the newsgroup. The email account listed in my From
    >> header is my spam trap, so I don't check it very often. You will get
    >> a quicker response by posting to the newsgroup.


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Sep 17, 2004
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. helpful sql
    Replies:
    0
    Views:
    795
    helpful sql
    May 19, 2005
  2. Replies:
    5
    Views:
    576
  3. Replies:
    4
    Views:
    922
  4. =?Utf-8?B?YmVub2l0?=

    Read CSV - string Columns - Int columns

    =?Utf-8?B?YmVub2l0?=, May 8, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    426
    =?Utf-8?B?YmVub2l0?=
    May 8, 2006
  5. Jacksm
    Replies:
    2
    Views:
    838
    Paul Chalekian
    Nov 21, 2006
Loading...

Share This Page