Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Syntax error.
Message
 
À
04/02/2002 05:50:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00614678
Message ID:
00614680
Vues:
16
This message has been marked as the solution to the initial question of the thread.
Hi Mike,

You've used a reserved word - DESC - in the SQL statement. Rename that field and things should work better. I'd also swap the " for ', and change the alltrim(cDesc) to strtran(alltrim(cDesc), ['], ['']) to make sure the server doesn't burp when the user includes a single quote in the description field. Finally, for readability's sake I'd rename the cPrice parameter to nPrice

Therefore my statement would be something like:
lparameters cDesc, cItemid, nPrice

nHandle = sqlconnect("DSN Name")
cSQL = [Update Accounting!items Set ItemDescr= ] + ['] + strtran(alltrim(cDesc), ['], ['']) + ;
  + [',] + [Price = ] + alltrim(str(nPrice)) +;
  [ Where itemid = ] + ['] + strtran(alltrim(cItemid), ['], ['']) + [']
Cheers,

Andrew

>Hi guys!
>
>Im trying to use a SQLPassthrough command on updating a table. The problem is very unusuall. I hope you can help me with this one. The code is provided below. Please check if I had omitted something.
>
>
>Thanks in advance...
>
>lparameters cDesc, cItemid, cPrice
>
>nHandle = sqlconnect("DSN Name")
>cSQL = [Update Accounting!items Set Desc = ] + ["] + alltrim(cDesc) + [",] +;
> [Price = ] + alltrim(str(cPrice)) +;
> [ Where itemid = ] + ["] + alltrim(cItemid)+ ["]


If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?


From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."


All my FoxTalk and other articles are available on my web site.


Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform