Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Insert FRom VFP to SQL
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00127638
Message ID:
00127760
Vues:
36
SQL Server uses the single quote as a text delimiter. If you want an apostrophe in a text string use two single quotes like this O''Donnel. Use can STRTRAN() in VFP to change all single quotes to two single quotes.

HTH

>The Followong is my code to insert a new record into a Stock Table of a SQL Server database from a standard VFP Table.
>
>nc=SQLCONNECT('winpos',"sa","")
>select stock
> cSQL = "Insert INTO STOCK ( "+;
> "CISBN, "+;
>"CBARCODE, "+;
> "CPRODCODE,"+ ;
> "CPRODNAME)"+;
> "Values ("+;
>"'"+Allt(STOCK.CISBN)+"', "+; "'"+Allt(STOCK.CBARCODE)+"', "+;
>"'"+AlltSTOCK.CPRODCODE)+"', "+;
>"'"+Allt(STOCK.CPRODNAME)+"')"
>sqlexec(nc,cSQL)
>
>This code Works Fine as Long as there is no Single Quotation Marks in any Field ie '
>
>Does any body have a solution of how to solve this problem. I cannot get rid of any quotation marks in the fields. There are authors names Like O'Donnel etc
"It is an important and popular fact that things are not always what they seem. For instance, on the planet Earth, man had always assumed that he was more intelligent than dolphins because he had achieved so much -- the wheel, New York, wars and so on -- whilst all the dolphins had ever done was muck about in the water having a good time. But conversely, the dolphins had always believed that they were far more intelligent than man -- for precisely the same reasons." - Douglas Adams
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform