If the import failed, you need to display an
error message.
SWin::Application.messageBox "Done! #{imported_count} records imported.",
"All done!"
rescue
SWin::Application.messageBox $!, "Error while importing"
end
The SWin::Application.messageBox displays a pop-up dialog box with a simple message.
You pass it two parameters: the first is the message itself, and the second is the title.
Note that the second call to messageBox uses the $! special variable, which contains a
description of the error. You might prefer to output a generic message and log the error to
a file, which you can do using the following code:
rescue
SWin::Application.messageBox "There was an error during the import process.",
"Error while importing"
File.open("training_loader.log", "a").puts $!
end
At this point, you have a web application for entering data, which gives you flexibility
and easy deployment, and it exports XML. You also have a desktop application, which
imports this XML into your Access database. This lets the administrator easily create customized
reports and present other information in a familiar, easy-to-use environment.
Pages:
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371