#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    2
    Rep Power
    0

    importing special characters


    I'm using VB6 ADO to read data from a text file, assign it to string variables and import it into an MS SQL database.

    One of the fields is the account name. It could have an apostrophe in it (Bob's Store).

    I use the INSERT statement to add the record.

    "INSERT tablename (name, address, ...) " _
    & "VALUES ('" & strName & "', '" & strAddress & "', "' & ...)"

    If strName includes an apostrophe, the procedure fails; it's getting mixed up with the other apostrophes / single quotes in the VALUES syntax. How can I treat the apostrophe as a text character and not a special character? I've tried a lot of options, but nothing seems to work.

    Thanks for any help you can provide!

    Doug
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    21
    Rep Power
    0
    if you use the replace function to replace the single apostrophe with two of them, it will insert a single apostrophe into the table.

IMN logo majestic logo threadwatch logo seochat tools logo