Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Double ampersands causes problem
Message
From
31/07/2007 08:54:33
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01244817
Message ID:
01244835
Views:
10
>VFP treats '&&' as begining of inline comment regardless if it's inside string literal or not. IMO, it's a bug which not going to be be fixed.
>You'll have to either split string literal or replace '&' with CHR(38)
>
>UPPER(Password)="&" + "&ETC       "
>* or
>UPPER(Password)= CHR(38) + CHR(38) + "ETC       "
>
What is sad about this is that it means wherever we have such a search where the data comes from a table or from something the user entered, we would have to do a STRTRAN() in order to make sure it will always work. Assuming the user would enter something like that, it would fail.

However, when doing the same SQL, by the use of VFPOleDB, from the .NET environment, as I always use a parameterized approach, this should not happen.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform