#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    2
    Rep Power
    0

    How to insert double quote (") char into record


    Hi everybody,

    I'm using Delphi and Firebird 2.5 and trying to add a string field just saying 3" (3 inches) but could not do so far. I tried many possibilities such as:
    := '3'+#34 //no good
    := ''3"'' //single,single+3+ double, single - no good either.
    etc. but no success.
    if I enter two double quotes in a string then it's ok though.
    Any help would be greatly appreciated.

    cengiz
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,785
    Rep Power
    348
    You didn't show us your real SQL statemtent, but the following works for me:

    Code:
    INSERT INTO some_table (some_column)
    VALUES
    ('3"');
    If you put your code between [code] tags as well, the differences between single and double quotes are easily visible.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    2
    Rep Power
    0
    This is very strange; I tried your code and did not on the work first time, later I changed the order of fields (accidentally) and it worked! I mean:

    s1:= '3"';
    s:= Format('INSERT INTO DUMY (ADate,AText) '+
    'VALUES (AT1,''%s'')', [s1]);

    this is ok but if I just change order and go like:

    s:= Format('INSERT INTO DUMY (AText,ADate) '+
    'VALUES (''%s'',AT1)', [s1]);

    then I get :
    "AT" Not found Error. I need to add text field at the end. Anyway it's working now, and your answer helped me a lot to dig out the problem. Thank you very much.

    cengiz

IMN logo majestic logo threadwatch logo seochat tools logo