Syntax error in string in query expression

R

rh1200la

Hey all...i'm getting this error message when trying to run a SQL
insert statement into an Access database using an OleDBCommand and
using an ExecuteNonQuery. Work's sometimes. Here's where it's
screwing up:

I am escaping the single quotes. Are there any other special
characters I need to remove?

{"Syntax error in string in query expression ''4/1/2007 10:12:00 AM --
Catalog fullfillment - ACT! Sales Cycle Presentation 40% \nThursday,
April 01, 2004 10:11:53 AM\r\n5/5/2007 7:30:00 AM -- \\rtf Responded
to e-mail\\par \\ansi\\deff0\\fonttbl\\f0\\fnil\\fcharset0 Tahoma;\r\n\
\viewkind4\\uc1\\pard\\lang1033\\f0\\fs1'."}


Here's the SQL. Works fine when I run it as a query in Access:

"INSERT INTO tblContacts (fldFirstName, fldLastName, fldHistory,
fldNotes) VALUES ('Lames','Jawson', '4/1/2007 10:12:00 AM -- Catalog
fullfillment - ACT! Sales Cycle Presentation 40% \nThursday, April 01,
2004 10:11:53 AM\r\n5/5/2007 7:30:00 AM -- \\rtf Responded to e-mail\
\par \\ansi\\deff0\\fonttbl\\f0\\fnil\\fcharset0 Tahoma;\r\n\
\viewkind4\\uc1\\pard\\lang1033\\f0\\fs17 Lames visited our site after
searching the Internet for gourmet coffee. He is looking for a
special blend for his employees and to give to his best clients.\\par\r
\n\r\n\0\r\n5/11/2007 1:00:00 PM -- \\rtf Conference Call for group
presentation of Truffle Sampler line\\par \\ansi\\ansicpg1252\\deff0\
\deflang1033\\fonttbl\\f0\\fnil\\fcharset0 Tahoma;\r\n\\viewkind4\\uc1\
\pard\\f0\\fs17 Conference Call Details: \\par\r\n\\par\r\nCall In
number: 1800-555-5555\\par\r\nParticipant Code: 234-2342-33234\\par\r\n
\r\n\0\r\n', '3/4/2007 1:30:00 PM -- First visit to CH Gourmet Gifts
website\r\n5/11/2007 1:54:00 PM -- \\rtf1\\ansi\\ansicpg1252\\deff0\
\deflang1033\\fonttbl\\f0\\fnil\\fcharset0 Tahoma;\r\n\\colortbl ;\
\red255\\green0\\blue255;\r\n\\viewkind4\\uc1\\pard\\f0\\fs17 Group
presentation went very well for the new offering of \\cf1\\b Truffle
Sampler\\cf0\\b0 . Lot''s of interest among the group.\\par\r\n\r\n\0\r
\n')"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top