Saving long text field to Access - Syntax Issue Problem

Discussion in 'ASP General' started by Drifter, Feb 6, 2004.

  1. Drifter

    Drifter Guest

    The quote below is part of the information i want to save to a MS Access
    database - or update, as the case may be.

    The original database was built a long time ago, and looking at the code for
    add/update on the original site-it does not compensate for odd syntax like
    the quotes. Problem i am hitting now is syntax issue in the SQL when I go to
    save/update. The syntax present causes failures every time.

    User said she had no problems adding product before now - but i cannot spot
    any code that avoids the issues of odd punctuation when i go to create the
    SQL.



    ---"
    It presents strategies for including humor and a positive attitude into the
    lives of healthcare workers.
    .............................................................................
    ................................. Click ''Buy Me'' below to purchase &
    download immediately (PDF version). To buy the HARD COPY or DISK versions,
    Click ''Ordering Information'' above & download an Order Form for the US or
    Canada.
    .............................................................................
    ............................
    ---"

    Any help appreciated.

    D
     
    Drifter, Feb 6, 2004
    #1
    1. Advertising

  2. > the quotes. Problem i am hitting now is syntax issue in the SQL when I go
    to
    > save/update. The syntax present causes failures every time.


    We can't offer much assistance unless you SHOW US that part.

    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/
     
    Aaron Bertrand [MVP], Feb 6, 2004
    #2
    1. Advertising

  3. Aaron Bertrand - MVP, Feb 6, 2004
    #3
  4. Drifter

    Drifter Guest

    Thanks for that link.

    Just noticed a very odd... oddity. When I am drawing the info from the
    database, the data is putting it into the Text field as if it were Single
    Quotes, Even though the original Data was a double quote (''). To make this
    clear - if I save the string (''save this'') It gets placed into the
    database as (''save this''), but when I populate the Text field (for an easy
    edit) on the ASP page - the text field populates like this ('save this')
    which means that when I go to save this again, it messes with the SQL. The
    ..replace will work, it is just a very odd way for the text box to populate -
    interpreting the ('') as ('). I never knew it did that.

    D



    "Aaron Bertrand - MVP" <> wrote in message
    news:O5$...
    > > It is taking the single quotes on the String

    >
    > VFAQ.
    > http://www.aspfaq.com/2035
    >
    > > these are 2 single quotes in a row btw

    >
    > That wasn't clear initially.
    >
    > --
    > Aaron Bertrand
    > SQL Server MVP
    > http://www.aspfaq.com/
    >
    >
     
    Drifter, Feb 6, 2004
    #4
  5. When you do the replace, ' becomes two of them '' (not to be confused with a
    double quote, ").

    This replacement is passed this way to the database. The reason we do this
    at all is so that the database understands which single quotes delimit the
    string, and which single quotes are embedded within it. When it finds two
    '' embedded within a string, it treats the first as an escape character, but
    only one of them ends up in the database.

    Make sense? The textarea isn't doing anything funny... go look at the data
    in the database after the insert, and you will see only one ' ...

    Always "encode" the data on the way in. Presentation is a different story.

    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/




    "Drifter" <loreseeker_prime@hotmail*removethis*.com> wrote in message
    news:c00gkp$iaf$...
    > Thanks for that link.
    >
    > Just noticed a very odd... oddity. When I am drawing the info from the
    > database, the data is putting it into the Text field as if it were Single
    > Quotes, Even though the original Data was a double quote (''). To make

    this
    > clear - if I save the string (''save this'') It gets placed into the
    > database as (''save this''), but when I populate the Text field (for an

    easy
    > edit) on the ASP page - the text field populates like this ('save this')
    > which means that when I go to save this again, it messes with the SQL. The
    > .replace will work, it is just a very odd way for the text box to

    populate -
    > interpreting the ('') as ('). I never knew it did that.
    >
    > D
    >
    >
    >
    > "Aaron Bertrand - MVP" <> wrote in message
    > news:O5$...
    > > > It is taking the single quotes on the String

    > >
    > > VFAQ.
    > > http://www.aspfaq.com/2035
    > >
    > > > these are 2 single quotes in a row btw

    > >
    > > That wasn't clear initially.
    > >
    > > --
    > > Aaron Bertrand
    > > SQL Server MVP
    > > http://www.aspfaq.com/
    > >
    > >

    >
    >
     
    Aaron Bertrand - MVP, Feb 6, 2004
    #5
    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. Lars Netzel

    Saving text to a field in access!

    Lars Netzel, Dec 13, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    331
    Kevin Spencer
    Dec 13, 2004
  2. George Marsaglia

    Assigning unsigned long to unsigned long long

    George Marsaglia, Jul 8, 2003, in forum: C Programming
    Replies:
    1
    Views:
    753
    Eric Sosman
    Jul 8, 2003
  3. Daniel Rudy

    unsigned long long int to long double

    Daniel Rudy, Sep 19, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,248
    Peter Shaggy Haywood
    Sep 20, 2005
  4. Mathieu Dutour

    long long and long

    Mathieu Dutour, Jul 17, 2007, in forum: C Programming
    Replies:
    4
    Views:
    519
    santosh
    Jul 24, 2007
  5. Bart C

    Use of Long and Long Long

    Bart C, Jan 9, 2008, in forum: C Programming
    Replies:
    27
    Views:
    854
    Peter Nilsson
    Jan 15, 2008
Loading...

Share This Page