displaying a particular record in a particular location

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default displaying a particular record in a particular location

    Greetings,

    I am working with two recordsets and I wish to display the last record
    from one of those sets in a particular place on a page, and then loop
    through the other records of the same set at another part of my page.
    The recordset in question contains 3 records. I have 1 through 2 at
    one place and I want to have the third record display'd somewhere else
    (not in the loop that displays the first two).

    I have the looping display OK, I am just lost as how to display the
    other record (the last record) at a place of my choice.

    Thanks all

    [email]joeweissjrSPAMOSPAMO@hotmail.com[/email]
    Joe Guest

  2. Similar Questions and Discussions

    1. Only 1 record displaying?
      Hi, I have a problem with Dreamweaver MX2004. I create my page as defined by the tutorial; connect to to my SQL database fine, displaying all the...
    2. Displaying the newest record first..
      I know this is probably a brain dead question, but I can't remember how to display the latest database entry first, and the oldest entry last. Any...
    3. Displaying only a part of a record field
      I would like to output only a part of a record field which is returned by a query. For example the outputed text would look like: "Drawing has...
    4. Displaying Date From a Database Record
      Hi, Can anyone help??? I am trying to display the date that a record was posted to a database to an asp page but it appears in the wrong format...
    5. Quick Record location - is it possible?
      You can use the wizard to make a search combo box. I would try placing it in the forms header part. If you database small (1000 record range),...
  3. #2

    Default Re: displaying a particular record in a particular location

    You could stick your rs into an array:

    Set rs = yourConn.execute("select [col1],[col2],[col3],[col4] from
    [theTable]")
    If Not rs.EOF Then aRecords = rs.GetRows()
    rs.Close
    Set rs = Nothing
    yourConn.Close
    Set yourConn = Nothing



    Then, if you want record number 3, you can do:

    response.write Records(0, 2)
    response.write Records(1, 2)
    response.write Records(2, 2)
    response.write Records(3, 2)

    That would be the same as:
    rs(0), (1), (2), (3) of the third record, which is index value 2 in the base
    0 array.

    Ray at work







    "Joe" <joew@vca.com> wrote in message
    news:1448d55e.0307211104.6c180d1d@posting.google.c om...
    > Greetings,
    >
    > I am working with two recordsets and I wish to display the last record
    > from one of those sets in a particular place on a page, and then loop
    > through the other records of the same set at another part of my page.
    > The recordset in question contains 3 records. I have 1 through 2 at
    > one place and I want to have the third record display'd somewhere else
    > (not in the loop that displays the first two).
    >
    > I have the looping display OK, I am just lost as how to display the
    > other record (the last record) at a place of my choice.
    >
    > Thanks all
    >
    > [email]joeweissjrSPAMOSPAMO@hotmail.com[/email]

    Ray at Guest

  4. #3

    Default Re: displaying a particular record in a particular location

    Thanks, here is a question on the same tangent:

    If I am going to be joining a few tables, how would I display the
    loop'd data for various records in different places?

    ie:
    "SELECT Events.eventTitle, Events.eventDesc, AheadDave.articleLead,
    AheadDave.articleDesc FROM Events, AheadDave WHERE monthID = 3"
    (above code may be schetchy - but that's the gist of what I'm after)

    I am going to loop through all of a few particluar records from table1

    MyRS("eventTitle")
    MyRS("eventDesc")

    and display them somewhere (in a table, let's say in the center of my
    page)


    I then want to be able to loop through & display other records from
    that join select statement

    MyRS("articleLead")
    MyRS("articleDesc")

    in another part of the page.


    Does that make sense?
    Joe Guest

  5. #4

    Default Re: displaying a particular record in a particular location

    That would still be fine, because the recordset will still be returned as
    just a two dimensional set of data that can be stuck into an array. In this
    case, eventTitle and eventDesc would be YourArray(iRecordNumber, 0) and
    YourArray(iRecordNumber, 1), respectively. articleLead and articleDesc
    would be YourArray(iRecordNumber, 2) and YourArray(iRecordNumber, 3)
    respectively.

    Whether your data comes from just one single table or a 5000 table join,
    that won't make a difference.

    Ray at work


    "Joe" <joew@vca.com> wrote in message
    news:1448d55e.0307221150.35b92a66@posting.google.c om...
    > Thanks, here is a question on the same tangent:
    >
    > If I am going to be joining a few tables, how would I display the
    > loop'd data for various records in different places?
    >
    > ie:
    > "SELECT Events.eventTitle, Events.eventDesc, AheadDave.articleLead,
    > AheadDave.articleDesc FROM Events, AheadDave WHERE monthID = 3"
    > (above code may be schetchy - but that's the gist of what I'm after)
    >
    > I am going to loop through all of a few particluar records from table1
    >
    > MyRS("eventTitle")
    > MyRS("eventDesc")
    >
    > and display them somewhere (in a table, let's say in the center of my
    > page)
    >
    >
    > I then want to be able to loop through & display other records from
    > that join select statement
    >
    > MyRS("articleLead")
    > MyRS("articleDesc")
    >
    > in another part of the page.
    >
    >
    > Does that make sense?

    Ray at Guest

  6. #5

    Default Re: displaying a particular record in a particular location

    I'm almost there...

    Here is my quandry (with a bit of my code - feel free to point out
    ugly spots)

    I have two tables that I'm working with

    july03
    events

    Here is my select statement:

    MySQL = "SELECT july03.*, events.* FROM july03 LEFT OUTER JOIN events
    ON events.month=july03.month"


    MyRS.Open MySQL, MyConn
    july03Array = MyRS.GetRows(,,"title")
    MyRS.MoveFirst
    eventsArray = MyRS.GetRows(,,"titleEvent")

    MyRS.Close
    Set MyRS = Nothing
    MyConn.Close
    Set MyConn = Nothing

    (this returns me 13 records from 'july03' and 2 records from 'events')


    Here is what I want to do...

    I want to write out/loop through the records from the july03 table and
    then write out/loop through the records from the events table.

    I came up with this code but it is not doing what I need:

    Dim rowLoop, colLoop
    for rowLoop = 0 to UBound(july03Array, 2)
    for colLoop = 0 to UBound(july03Array, 1)
    response.write(july03Array(colLoop, rowLoop) & "<br>")
    next
    next

    response.write "NEXT GROUP <BR><BR>"

    for rowLoop = 0 to UBound(eventsArray, 2)
    for colLoop = 0 to UBound(eventsArray, 1)
    response.write(eventsArray(colLoop, rowLoop) & "<br>")
    next
    next

    If you could provide me with some code/instruction to get what I am
    after I would be most appreciative.

    Thanks

    Joe
    Joe Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139