Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

ASP database

  • 24-02-2004 08:30PM
    #1
    Closed Accounts Posts: 725 ✭✭✭


    I have a html page called "INDEX.HTML" that has 5 links (the 5 links are brand names).
    These 5 links all point to an ASP page called "PRODUCTS.ASP".
    The "PRODUCTS.ASP" page is generated from data in a database called "AS3044".
    The code is working and data is returned from the database, however I want the ASP page to return data based on the link clicked on the html page.


    For instance if I click on the "Levis" link I want the ASP page to only return values from the database with the Levis in them.

    I can allready do this in a static manner using this code :

    <% sqltext= "SELECT * FROM Product WHERE brand = 'Levis' " %>


    How do I make this code dynamic, i.e. recieve a value from the link clicked on the html page and pass it to the line of code above?


Comments

  • Moderators, Politics Moderators, Paid Member Posts: 44,265 Mod ✭✭✭✭Seth Brundle


    I had typed out the whole procedure for you but effin MSIE'e an accidental press of the tab followed by the backspace buttons ruined all that.
    Try download the tutorial from www.manastungare.com.
    Killian

    Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/ .



  • Registered Users, Registered Users 2 Posts: 11,985 ✭✭✭✭zAbbo


    Use URL parametres, can`t remember now, but im sure Tony would give you a hand ;)

    < a href"=details.asp?item=levis">levis</a>

    and the details page would be pulling the data which would be equal to the parameter you have assigned in the code.

    Man i knew this inside out last year, not now tho :(


  • Moderators, Politics Moderators, Paid Member Posts: 44,265 Mod ✭✭✭✭Seth Brundle


    bugger it - here goes again :rolleyes:

    step 1:- all links to the products should be like this <A HREF="products.asp?product=Levis"...

    Step 2:- products.asp should contain the code to collect the product from the querystring as follows:-
    <%
    Dim qstring
    qstring = Request.Querystring("product")
    %>

    Step 3:- base your SQL SELECT statement on this variable as follows:-
    <%
    Dim RS, theSQL
    Set RS = Server.CreateObject("ADODB.Recordset")
    theSQL = "SELECT * FROM AS3044 WHERE product='" & qstring & "'"
    RS.Open theSQL, Conn
    %>
    Note:- the quotes around qstring in the select statement are as follows
    single, double & qstring & double, single, double
    it won't work if unlike this.


    You should still read that tutorial though
    K.

    Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/ .



  • Closed Accounts Posts: 725 ✭✭✭pat kenny


    Cheers lads thanks for the help.


Advertisement