quote marks in sql statement

Discussion in 'Questions (Windows Mobile)' started by tremara1, Dec 31, 2008.

  1. tremara1

    tremara1 Active Member Licensed User

    Hi everyone, I am trying to write a code snippet library with sqlite. My main problem is when I put an sql statement together with code sample containing quotes and apostrophes from a multiline textbox it does not treat it as text but as code. I have done this in vb6 but cant seem to get it right in b4ppc.
    This is the sql statement the problem is txtAddCode.text is the code I want to store.

    Addtext = "INSERT into snippet(snip,code,att) values('"
    Addtext = Addtext & txtAddSnip.text
    Addtext = Addtext & "','" & txtAddCode.text
    Addtext = Addtext & "','" & txtAddAtt.text & "')"
    If there is a solution it is probably simple.....

    thanks tremara1
    Australia
     
  2. RB Smissaert

    RB Smissaert Well-Known Member Licensed User

    Look in the SQL help at AddParameter and SetParameter and use that.
    With that you don't need the quotes and it will probably be faster as well.

    RBS
     
  3. Cableguy

    Cableguy Expert Licensed User

    You can add Quotes by using CHR(34)...
    ie :
    name="cableguy"
    To place in a string with initial and final quotes included would be like this:
    Chr(34)&"name="&Chr(34)&"cableguy"&Chr(34)

    The final string would then look like this:

    "name="Cableguy""
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    I second that.
    The link: SQL
     
  5. tremara1

    tremara1 Active Member Licensed User

    Thanks..........

    I love this stuff......the AddParameter,SetParameter worked perfectly, I am learning heaps from you guys....much appreciated.

    tremara1
    Ballarat Victoria Australia
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice