Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with && found in SQL text
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00839009
Message ID:
00839030
Vues:
22
Bob,
Unfortunatelly, VFP recognizes '&&' as beginning of an inline commenmt even if it's inside a string literal. There're a couple ways around this:
- Don't use macro sustitution so variable isn't conveted into a string literal.
SELECT ... WHERE eDesc = fromTab.eDesc into curs rec2
- Separate '&' in the literal.
selefrom=[...... WHERE eDesc="] + ;
    STRTRAN(fromTab.eDesc, [&] + [&], [&" + "&]) + [" into curs rec2]
>In building an application for a client I ran accross this problem.
>
>As a little background, all the data processed comes from the client's server and is untouched by my application built using VFP8.0
>
>From there SQL server, I found a group of records that contains something of the following.
>
>"PHMSC022 RR#138.03 SHELF 58 UPD-48&&-63" found in table/field fromTab.eDesc
>
>Please note the "&&" in the field.
>
>I need to match another record with this field and there lies my problem.
>
>In preparing the SQL I do the following.
>
>selefrom=[...... WHERE eDesc="]+fromTab.eDesc+[" into curs rec2]
>&selefrom
>
>When the SQL if fired, I get an error. Through investigation, if I remove one of the "&", there is no error. I'm puzzled by this as eventhough the && is used to seperate executing code from comments of the same line, the && is enclosed within a text string.
>
>Any thoughts?
>
>This is easy to try as just build an SQL and use test="&&" where test is a text field or the name of any any existing text field in a table and see what happens.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform