Checking for Errors

When you issue commands to the ITRDS you are going to want to know if there were any errors. To do this you need to access two properties of the object you are using. For example, say I issue the command as per the previous topics but with an invalid code;

loITRDS.SetConnection("INVALIDCODE")

To determine if an error occurred, you need to look at the property lError. This property will be True if an error occurred and False if not. To obtain the error message you need to look at the cErrorMsg property. Both these properties are on every object within the ITRDS

Hence a common structure for issuing commands with the ITRDS would be

If loITRDS.oConnection.lError

lcErrorMessage = loITRDS.oConnection.cErrorMsg
Wait Window lcErrorMessage
Return .F.

Endif

NB: This is a bit of a special case in that you needed to know that the "SetConnection" command will place it's errors in the
oConnection object. Generally though this will not be a problem as in 99% of cases the methods are always performed on the
appropriate object (shown later on)


Last Updated: 21/12/2004