November 18th, 2003, 11:05 AM
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!
November 18th, 2003, 11:57 AM
if you use the replace function to replace the single apostrophe with two of them, it will insert a single apostrophe into the table.