>>if SQLEXEC(nHandle, m.lcSQL) <0
>> &&Check the actual error with aerror()
>>ENDIF
>>
>>I think your code was OK also, but better to write them as separate lines and you should always check the return value of SQLExec.
>
>Thank you, Naomi. Just as I read your message I realized why I had the problem last night. I am trying to make my code work on both VFP and SQL Server. And I was testing last night on VFP. And of course, this type of syntax would not apply to VFP at all. So I will probably execute each UPDATE separately. I wonder, though, if I could enclose these two UPDATE (for SQL Server) with Transaction so that I can undo changes if one of the UPDATEs fails. I will test it.
It may be better to enclose them into explicit transaction. Most likely they already will be part of implicit transaction, but better to not rely on this.
If it's not broken, fix it until it is.
My Blog