ASP Newbie Question

Discussion in 'ASP General' started by Brian Jorgenson, Nov 30, 2004.

  1. I have an ASP file querying 3 fields in a database. I have noticed on
    many websites that use asp is that after the <page>.asp the have a ?
    and then a field name = to a value. How does this work? How can I make
    it work for me? For example one of my fields is NAME. if I have an asp
    page called request.asp?name=bob then should I only get the record
    for bob?
    Brian Jorgenson, Nov 30, 2004
    #1
    1. Advertising

  2. In short,

    sql = "SELECT columns FROM table WHERE columnName = '" &
    Request.QueryString("name") & "'"

    For the long version, please see some ASP tutorials.
    http://www.aspfaq.com/2183

    --
    http://www.aspfaq.com/
    (Reverse address to reply.)




    "Brian Jorgenson" <> wrote in message
    news:...
    > I have an ASP file querying 3 fields in a database. I have noticed on
    > many websites that use asp is that after the <page>.asp the have a ?
    > and then a field name = to a value. How does this work? How can I make
    > it work for me? For example one of my fields is NAME. if I have an asp
    > page called request.asp?name=bob then should I only get the record
    > for bob?
    Aaron [SQL Server MVP], Nov 30, 2004
    #2
    1. Advertising

  3. Brian Jorgenson wrote:
    > I have an ASP file querying 3 fields in a database. I have noticed on
    > many websites that use asp is that after the <page>.asp the have a ?
    > and then a field name = to a value. How does this work? How can I make
    > it work for me?


    When an HTML FORM is submitted, it supplies either a querystring or a form
    collection to its ACTION, depending on whether its METHOD is "get" or
    "post". Name-value pairs come from successful controls. Example:

    <form action="request.asp" method="get">
    <input name="name" value="bob">
    </form>

    This form will produce your querystring: request.asp?name=bob. In contrast,
    if the form METHOD is "post", there will be no querystring, but rather a
    collection of name-value pairs submitted to request.asp in the headers.

    Up to this point, this is simply an HTML question...



    > For example one of my fields is NAME. if I have an asp page
    > called request.asp?name=bob then should I only get the record
    > for bob?


    ....Now it becomes an ASP one. You can process the data in request.asp by
    evaluating the proper collection elements:

    Request.Form("name").Item (for "post")
    Request.QueryString("name").Item (for "get")


    Based on your question, I suggest you find an ASP tutorial, as I am glossing
    over many things to provide a succinct answer.



    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.
    Dave Anderson, Nov 30, 2004
    #3
  4. Brian Jorgenson

    Hal Rosser Guest

    "Brian Jorgenson" <> wrote in message
    news:...
    > I have an ASP file querying 3 fields in a database. I have noticed on
    > many websites that use asp is that after the <page>.asp the have a ?
    > and then a field name = to a value. How does this work? How can I make
    > it work for me? For example one of my fields is NAME. if I have an asp
    > page called request.asp?name=bob then should I only get the record
    > for bob?


    Dave answered your question
    I'll just add that you can also append the "?" and the name=value pairs to
    the url of a hyperlink.
    Learn asp - you'll like it.



    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.799 / Virus Database: 543 - Release Date: 11/19/2004
    Hal Rosser, Dec 1, 2004
    #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. Jerry C.
    Replies:
    8
    Views:
    214
    Uri Guttman
    Nov 23, 2003
  2. Kruno Saho
    Replies:
    0
    Views:
    128
    Kruno Saho
    Apr 7, 2013
  3. Dave Angel
    Replies:
    0
    Views:
    113
    Dave Angel
    Apr 7, 2013
  4. rusi
    Replies:
    0
    Views:
    102
  5. Miki Tebeka
    Replies:
    0
    Views:
    76
    Miki Tebeka
    Apr 7, 2013
Loading...

Share This Page