www.webdeveloper.com
Results 1 to 6 of 6

Thread: How to get Link to pass value from Recordset

  1. #1
    Join Date
    Mar 2005
    Location
    Perth, Australia
    Posts
    9

    How to get Link to pass value from Recordset

    Hi All,

    Help of yesterday a great help, thanks.

    I now have an ASP page that produces a list of Recording Artist names by grabbing all the Artists beginning with 'B' from the database for instance. Beautiful!!! My recordset also returns the 'ArtistID' number used as the primary key in the database.

    I want to make each one of the Recording Artists in the list its own link and in the target page use the ArtistID to produce a list of all the recordings in stock by that artist.

    My question is, how do I get the link to pass the ArtistID in the URL so I can use Request.QueryString in the target page to base a recordset on it?

    Any ideas?

    Regards,

    El Toro.

  2. #2
    Join Date
    Dec 2004
    Posts
    8,637
    As an example, I like to code mine this way -- so that I can still use my WYSIWYG editor to design the table layout:
    Code:
    <table>
    <%
    Do While Not rs.EOF
        artistID = rs.Fields("id").Value
        artistName = rs.Fields("name").Value
    %>
      <tr>
        <td><a href="details.asp?id=<%=artistID%>"><%=artistName%></a></td>
        <td>etc.</td>
      </tr>
    <%
        rs.MoveNext
    Loop
    %>
    </table>
    In the details.asp page:
    Code:
    artistID = Request.QueryString("id")

  3. #3
    Join Date
    Mar 2005
    Location
    Perth, Australia
    Posts
    9

    Smile

    Thanks phpnovice,

    You're more competent than me!

    This is coming slowly back to me now and your solution is just what I needed.

    Thanks again

    El Toro.

  4. #4
    Join Date
    Dec 2004
    Posts
    8,637

    Thumbs up You're welcome.

    Cheers.

  5. #5
    Join Date
    Mar 2005
    Posts
    208
    How we can do the same in ASP.net and pass that value to database and do a select ? Thanks

  6. #6
    Join Date
    Dec 2004
    Posts
    8,637
    Sorry, I don't touch ASP.NET.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles