[Gambas-user] Syntax help for IF after a Try statement
Adam Ant
adamnt42 at ...626...
Thu Aug 9 05:21:40 CEST 2012
On Thu, Aug 9, 2012 at 12:35 PM, rocko <sunblaster5 at ...626...> wrote:
> Ok if I replace the 'Else If' with an 'Else'
> I get an error:
> Else without If.
> But there is an 'If' after the 'Try'.
> unless you can't put an 'Else' after an 'Try...If'
Ah! No you can't use
Try If blahblahblah
(and there are some other things you can't "TRY", I can't think of
them at the moment)
Be very aware of what "TRY" actually does!
Oh and by the way, to test if a connection is already open, the
function you need is
<Connection>.Opened()
So,
Try $conn.Open()
If Error then
Print "Not Open"
Else
Print "Opened it!"
End If
or
$conn.Open
If $conn.Opened() then
Print "Not Open"
Else
Print "Opened it!"
End If
should both work.
hth
Bruce
More information about the User
mailing list