[Gambas-user] is endif optional?

Werner wdahn at ...1000...
Fri Sep 22 10:17:11 CEST 2006


For some reason unremembered the code snippet below was in some software
I wrote a while ago and it all worked.

' Gambas module file

PUBLIC SUB Main()
DIM hConn AS NEW Connection

'fill this in to suit your situation
  WITH hConn
    .Type = "mysql"
    .Host = "localhost"
    .Login = ""
    .Password = ""
    .Name = "test"
  END WITH

  TRY hConn.Open
  IF ERROR THEN PRINT "Can't open db. Reason: " & ERROR.Text

'I cut the real code out.
'ISTR that when the opening of the connection failed (ie wrong user) the
error cropped up further down when using the connection.
'Nevertheless, the absence of ENDIF was never complained about.
  PRINT "yabadoo"


END

Best Regards
Werner Dahn




More information about the User mailing list