Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Insert problem
Message
From
28/10/2005 15:10:10
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
SQL Insert problem
Environment versions
Visual FoxPro:
VFP 9
Database:
MS SQL Server
Miscellaneous
Thread ID:
01063101
Message ID:
01063101
Views:
40
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?

Thanks,

Jerry
Next
Reply
Map
View

Click here to load this message in the networking platform