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.