Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

ASP database

  • 24-02-2004 8: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 Posts: 41,229 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


  • Registered Users, Registered Users 2 Posts: 11,987 ✭✭✭✭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 Posts: 41,229 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.


  • Closed Accounts Posts: 725 ✭✭✭pat kenny


    Cheers lads thanks for the help.


Advertisement