Insert statement

Discussion in 'ASP General' started by David, Apr 4, 2007.

  1. David

    David Guest

    Hi,

    I have an asp page which runs an update into our mysql database.
    The only problem I have is that a user selects a customer from a
    dropdown (this is database fed), and I require the selected item to be
    loaded into the db. All I can get in the database is the first part of
    their name upto the first space ?

    i.e. if the selected item from the dropdown is A B Knowles, the
    database entry is 'A'

    cust = request.form("customername")

    I have tried adding ' " & cust & " ' for the insert statement

    What do I need to do to fix this minor glitch


    Thanks


    David
     
    David, Apr 4, 2007
    #1
    1. Advertising

  2. David wrote:
    > Hi,
    >
    > I have an asp page which runs an update into our mysql database.
    > The only problem I have is that a user selects a customer from a
    > dropdown (this is database fed), and I require the selected item to be
    > loaded into the db. All I can get in the database is the first part of
    > their name upto the first space ?
    >
    > i.e. if the selected item from the dropdown is A B Knowles, the
    > database entry is 'A'
    >
    > cust = request.form("customername")
    >
    > I have tried adding ' " & cust & " ' for the insert statement
    >
    > What do I need to do to fix this minor glitch
    >
    >

    Show us the result of

    Response.Write cust & "<BR>"
    Response.Write strSQL


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Apr 4, 2007
    #2
    1. Advertising

  3. David wrote on 4 Apr 2007 07:01:30 -0700:

    > Hi,
    >
    > I have an asp page which runs an update into our mysql database.
    > The only problem I have is that a user selects a customer from a
    > dropdown (this is database fed), and I require the selected item to be
    > loaded into the db. All I can get in the database is the first part of
    > their name upto the first space ?
    >
    > i.e. if the selected item from the dropdown is A B Knowles, the
    > database entry is 'A'
    >
    > cust = request.form("customername")
    >
    > I have tried adding ' " & cust & " ' for the insert statement
    >
    > What do I need to do to fix this minor glitch
    >


    Check the HTML where the select list is, if it looks like:

    <option value=A B Knowles>A B Knowles</option>

    then the reason you only get A into your database is because the browser is
    only sending A back to your ASP page. Make sure your values have quotes
    around them. ie

    <option value="A B Knowles">A B Knowles</option>

    and it should work fine.

    Dan
     
    Daniel Crichton, Apr 4, 2007
    #3
    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. Replies:
    3
    Views:
    833
  2. Jay McGavren
    Replies:
    11
    Views:
    1,181
    Alan Krueger
    Jan 16, 2006
  3. tedsuzman
    Replies:
    2
    Views:
    7,162
    Michel Claveau, résurectionné d'outre-bombe inform
    Jul 21, 2004
  4. Ted
    Replies:
    1
    Views:
    493
    Duncan Booth
    Jul 22, 2004
  5. J. Muenchbourg
    Replies:
    3
    Views:
    258
    Aaron Bertrand - MVP
    Sep 30, 2003
Loading...

Share This Page