Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Insert problem
Message
 
 
To
28/10/2005 15:10:10
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
Database:
MS SQL Server
Miscellaneous
Thread ID:
01063101
Message ID:
01063104
Views:
10
This message has been marked as the solution to the initial question of the thread.
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform