Hi Craig,
The problem here is i would also expect an exception to be triggered by the try-catch block, but a open dialog box is displayed to the user instead. I agree with you that the code is wrong and could be fixed simply by adding a
if used() But the point of a try-catch block is to avoid unnecessary test like this, is it ?
Why would VFP ask a user to open a table or select an OCX (when an OCX is not registered on the client machine)? It is really not an acceptable behavior from a development tool. It's like VFP saying
"Hey you, programmer, you didn't do your job properly so let me ask the user if he can do a better job!">I'm not sure what you're saying the problem is. The table was closed before the SCAN. I expect it to fail. Again, this is not the fault of VFP, but rather the way the code was written.
>
>
>>Humm, i don't get what you say here... Here's the full example
>>
>>
>>=SqlExec(myHandle, "Select * from MyTable", "MyTable")
>>PlayWithMyTable()
>>ScanMyTable()
>>
>>Function PlayWithMyTable
>> *--- Do some stuff
>> Use In MyTable
>>Endfunc
>>
>>Function ScanMyTable
>>try
>> *-- In the program here i expect the cursor to be there
>> *-- but some other functions may have closed it
>> Scan
>> *--- Some code here
>>
>> EndScan
>>catch
>>...
>>
>>EndFunc
>>
>>