I need to update an SQL table from VFP 6. I can not change editions as the SBT/ACCPAC version in use is PRO 6.0 which runs in it. Upgrading is not a current option.
I'm sending a set mailaddress=mmailaddress command as part of an SQL statement.
We have a few distributors who live on streets like B'Bob
I store the street address into a variable using the following:
STORE NVL(rs.FIELDS("MAILADDRESS1").VALUE,"") TO m1mailaddress
This generally works fine.
The update is created like this:
lcsql=lcsql+"ship_address='"+ALLTRIM(m1mailaddress)+"', "
This results in code that looks similar to this:
UPDATE DISTRIBUTORS.DBO.DISTRIBUTORS SET MAILADDRESS1 = '1919 SOUTH B'BOB STREET' WHERE DIST_ID=1093
The issue here is when a string contains something like B'Bob it crashes.
A suggesting has been made to check every string for an apostrophe and replace it with a double apostrophe. This works in SQL Query Analysier, haven't tried it in Fox but sounds like this would cause a speed hit.
Any suggestions?
Bill Couture
sbtbill@aol.com
I'm sending a set mailaddress=mmailaddress command as part of an SQL statement.
We have a few distributors who live on streets like B'Bob
I store the street address into a variable using the following:
STORE NVL(rs.FIELDS("MAILADDRESS1").VALUE,"") TO m1mailaddress
This generally works fine.
The update is created like this:
lcsql=lcsql+"ship_address='"+ALLTRIM(m1mailaddress)+"', "
This results in code that looks similar to this:
UPDATE DISTRIBUTORS.DBO.DISTRIBUTORS SET MAILADDRESS1 = '1919 SOUTH B'BOB STREET' WHERE DIST_ID=1093
The issue here is when a string contains something like B'Bob it crashes.
A suggesting has been made to check every string for an apostrophe and replace it with a double apostrophe. This works in SQL Query Analysier, haven't tried it in Fox but sounds like this would cause a speed hit.
Any suggestions?
Bill Couture
sbtbill@aol.com