Paradox Community

Items in pnews.paradox-programming

Subject:Re: Tcursor
Date:Sat, 30 Mar 2019 09:30:13 +1000
From:Leslie <"ViaThe List"@NOSPAM.com>
Newsgroups:pnews.paradox-programming
I know this may seem quaint, but how about you check the return code and 
then take the appropriate action which may or may not be to display a 
message to the user.

fwiw
Leslie.


On 29/03/2019 7:16 AM, Peter wrote:
> Once a tcursor is opened is there is any way tc.edit() can fail?
>
> I used to always do this
> if tcu.open(":alias:Atable") then
>    if not tc.edit() then
>       tc.close()
>    endIf
> endIf
>
> The problem with if/endif is that if open fails then Pdox err comes up
> and I would rather it didn't so I switched to try/endTry
> try
>    tc.open(":alias:Atable")
>    tc.edit()
> onFail
>      msgInfo("error","error msg")
>      if tc.isAssigned() then
>         tc.close()
>      endIf
> endTry
>
> Using try/endTry, will trap a problem with opening but not edit, even if
> I put a write lock (from a different machine) on the table the onFail
> does not trigger. So I am wondering if it is possible that edit could
> ever fail.
>
> Thank you.
>
> Peter
>
>

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


Copyright © 2004 thedbcommunity.com