Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Syntax error.
Message
 
To
04/02/2002 05:50:15
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00614678
Message ID:
00614680
Views:
15
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform