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.
// Event delegate for 'click' event
dbName = "mydb"
if ExecuteCommand1('open database &dbName')
tab._name = "a"
//This will raise an error
if tab.name = "a"
catch to e
Put the return statements outside the try/endtry block:
RETURN is also not allowed inside a TRY block or a CATCH block
// ? "Tried"
lreturn = .T.
catch to e
// ? "Caught"
lreturn = .F.
My goal is to create a function to clear column data (‘old value’ and ‘new value’) from any array based on array name.
you could pass the array name and macro substitute it where necessary.
arr1(1,1) = 'txtName'
arr1(1,2) = 'test'
arr1(1,3) = 'testing'
&myarray(1,2) = .f.
&myarray(1,3) = .f.
do myproc with "arr1"
what does the ‘&’ sign just before the (field(i)) do? (? &(field(i)))
The “&” character indicates a macro substitution:
SELECT COUNT(GSID) AS CountEntry FROM bantam_stats!gamesheet WHERE gamenumber = &GameNumber AND hometeam IN ("&strTeamID")
Remove the quotes:
lcCursor = "Cursor2"
open database southwind
select * from shippers into cursor (lcCursor)
insert into shippers select * from (lcCursor)
Why not just use a &cursor2
lianja supports macro expressions too &(basename(cursor2))