SQL Insert Query using ADO

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default SQL Insert Query using ADO

    Hi,

    I am sending an SQL Insert query to my ADO connection
    object, my Insert query looks a litte like this...

    INSERT INTO tblRequests
    (RequestedBy,ContactPerson,RequestReason) VALUES ('Test
    Person','Joe Bloggs','The main reason's are this...')

    Notice that the value of the RequestReason field contains
    a ' character in the word "Reason's", SQL seem to handle
    this as the end of the value for that field. How can I
    stop this from happening? I don't want to have to remove
    all ' chars from each field value?

    Help. Tia!
    Tim johnson Guest

  2. Similar Questions and Discussions

    1. INSERT Statement Query
      Hi, I am about to embark on performing a data migration into a MySQL database. The goal is to be able to take the input data, and generate SQL...
    2. INSERT QUERY WEIGHT
      Hi I would like to know if there is a limit in mysql to the weight of an insert query, I mean which size of data can I insert in my table at the...
    3. mulitple query insert problem
      Ben. I am doing the scenario where the id key is auto generated from Access. I know I need to get that id to do the second insert into the...
    4. INSERT error :: Updateable query?
      I am picking up an error message on a straightforward INSERT - do I need an optimistic-type to get this working....here is is the error: ...
    5. Query to insert into current record
      It sounds as though you are using one file (table), and you want all this activity to take place within the one file. You don't say where (what...
  3. #2

    Default Re: SQL Insert Query using ADO

    To escape a single quote, you need to double it, so your SQL statement looks
    like this:

    INSERT INTO
    tblRequests
    (
    RequestedBy
    , ContactPerson
    , RequestReason
    )
    VALUES
    (
    'Test Person'
    , 'Joe Bloggs'
    , 'The main reason''s are this...'
    )

    (that's two ' in a row, not a double quote)

    Cheers
    Ken

    "Tim johnson" <timj@smithscity.co.nz> wrote in message
    news:054701c366aa$d855c900$a401280a@phx.gbl...
    : Hi,
    :
    : I am sending an SQL Insert query to my ADO connection
    : object, my Insert query looks a litte like this...
    :
    : INSERT INTO tblRequests
    : (RequestedBy,ContactPerson,RequestReason) VALUES ('Test
    : Person','Joe Bloggs','The main reason's are this...')
    :
    : Notice that the value of the RequestReason field contains
    : a ' character in the word "Reason's", SQL seem to handle
    : this as the end of the value for that field. How can I
    : stop this from happening? I don't want to have to remove
    : all ' chars from each field value?
    :
    : Help. Tia!


    Ken Schaefer Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139