Q:
The problem appears to be the '&sql' executing inside a try block, if this happens and then an error is generated afterwards, the crash occurs.
Changing various elements of the code causes the problem not to occur, this was the only combination where I could get it to happen reliably.
Code:
////////////////////////////////////////////////////////////////
// Event delegate for 'click' event
proc page1_section2_field2_click()
dbName = "mydb"
if ExecuteCommand1('open database &dbName')
private tab[]
tab._name = "a"
//This will raise an error
if tab.name = "a"
endif
endif
endproc
function ExecuteCommand1(sql)
try
&sql
return .T.
catch to e
return .F.
endtry
endfunc
A:
Put the return statements outside the try/endtry block:
RETURN is also not allowed inside a TRY block or a CATCH block
Code:
function ExecuteCommand1(sql)
try
&sql
// ? "Tried"
lreturn = .T.
catch to e
// ? "Caught"
lreturn = .F.
endtry
return lreturn
endfunc
All topics in [Answers] alphabetically: http://www.lianja.com/community/show...p?2717-Answers
Bookmarks