Try/Catch Block

All of the methods within the YMLD application rely on try/catch blocks to trap any errors that might occur when an SQL statement is issued. The catch block is identical in all of the YMLD methods.

try
  Odbc methods...
Catch se As OdbcException
  MsgBox(se.Message)
end try

There is no need to format the error message because the ODBC driver will create the complete message string. The catch block only displays the error message. A programmer might want to capture the error state to determine what should be done with the error. The YMLD application only displays the error message and then continues. A sample error message is shown in Figure 12-6.

Figure 12-6. Sample error message

Get Apache Derby—Off to the Races: Includes Details of IBM® Cloudscape™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.