You've to double single quotes inside a string literal encloused into single quoutes. You can use SPT parameters instead
lcsql = [INSERT INTO mytable (company, name) VALUES (?lcCompamy, ?lcName )]
>I am trying to get the following SQL Insert to run from VFP9 into a SQL Server table. Normally this runs, but when a value contains an ' mark in the data, the SQLEXEC() fails.
>
>In the following example, the lcCompany var contains "PAUL'S INDUSTRIES INC" which causes the SQLEXEC() to fail. If the value was "PAULS INDUSTRIES INC" without the ', the insert would work.
>
>***My example.
>myconn = SQLCONNECT('mydsn', 'mydata', 'mypwd')
>lcCompany = [PAUL'S INDUSTRIES INC]
>lcName = [Paul Smith]
>lcsql = [INSERT INTO mytable (company, name) VALUES ('] + lcCompamy + [', '] + lcName + [')]
>
>=SQLEXEC(myconn, lcsql, '')
>**********************************
>
>How can I get this to work properly?
--sb--