Query Database, Display as hyperlink

Discussion in 'ASP General' started by BOBss, Jun 20, 2007.

  1. BOBss

    BOBss Guest

    I am using ASP with VBScript. I want to query an access database username
    field, and display the output as a hyperlink on an a webpage.The webpage
    will display all records. I then need to be able to select a given
    record(hyperlink), and display all of the fields for that record on another
    webpage so I can execute some code against it.

    Can anyone point me to some sample code so I can get an idea of how to
    accomplis this?

    Thanks in advance
     
    BOBss, Jun 20, 2007
    #1
    1. Advertising

  2. Gazing into my crystal ball I observed "BOBss" <> writing
    in news::

    > I am using ASP with VBScript. I want to query an access database
    > username field, and display the output as a hyperlink on an a
    > webpage.The webpage will display all records. I then need to be able
    > to select a given record(hyperlink), and display all of the fields for
    > that record on another webpage so I can execute some code against it.
    >
    > Can anyone point me to some sample code so I can get an idea of how to
    > accomplis this?
    >
    > Thanks in advance
    >
    >
    >

    <%

    dim sql, rs, rsarr, norecords, i

    'I don't know your fieldnames, just assuming here

    sql = "SELECT id, username FROM table "
    set rs = createobject("ADODB.Recordset")
    rs.Open sql, yourconnection
    if not rs.EOF then
    rsarr = rs.getrows()
    norecords = false
    else
    norecords = true
    end if
    rs.Close
    set rs = nothing

    if not norecords then
    %>
    <ul>
    <%
    for i = 0 to ubound(rsarr,2)
    %>
    <li><a href="processpage.asp?id=<%=rsarr(0,i)%>"><%=rsarr(1,i)%></li>
    %>
    next
    %>
    </ul>
    <%
    else
    %>
    <p>No records available.</p>
    <% end if%>



    ---- processpage.asp ----
    <% id = request.querystring("id")
    sql = "SELECT fields FROM table WHERE id = " & id
    'do whatever else you need to do from here

    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne Boswell, Jun 21, 2007
    #2
    1. Advertising

  3. BOBss

    Evertjan. Guest

    Adrienne Boswell wrote on 21 jun 2007 in
    microsoft.public.inetserver.asp.general:

    > <li><a href="processpage.asp?id=<%=rsarr(0,i)%>"><%=rsarr(1,i)%></li>
    >


    </a> ?

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jun 21, 2007
    #3
  4. Gazing into my crystal ball I observed "Evertjan."
    <> writing in news:Xns99566422D4289eejj99@
    194.109.133.242:

    > Adrienne Boswell wrote on 21 jun 2007 in
    > microsoft.public.inetserver.asp.general:
    >
    >> <li><a href="processpage.asp?id=<%=rsarr(0,i)%>"><%=rsarr(1,i)%></li>
    >>

    >
    ></a> ?
    >


    Validation Failed - XXX Errors

    It was late, sorry about that.

    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne Boswell, Jun 21, 2007
    #4
    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. =?Utf-8?B?U1M=?=
    Replies:
    3
    Views:
    3,856
    Juan T. Llibre
    May 15, 2005
  2. Learner
    Replies:
    1
    Views:
    1,004
    Marina Levit [MVP]
    Jan 30, 2006
  3. davetichenor
    Replies:
    1
    Views:
    856
    Eliyahu Goldin
    Oct 30, 2006
  4. Ken
    Replies:
    1
    Views:
    396
    Alvin Bruney
    Aug 16, 2003
  5. LU

    query database, create control, display on page

    LU, Mar 26, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    144
Loading...

Share This Page