Returns the message associated with the current error object.
PSErrorClass objects
errorobject.GetMessage( )
Argument |
Description |
---|---|
errorobject |
A variable that contains a reference to an instance of PSErrorClass |
String
At runtime, GetMessage has the following behavior:
Application server |
Runtime behavior |
---|---|
ASP |
Returns the most recent error message, which is obtained by accessing the Description property of the Error object |
JSP |
Returns the most recent error message stored in the named error object |
The following example for an ASP target connects to a database and retrieves some data. If an error occurs, it uses GetMessage to get the error message:
myconnect = psServer.GetConnection("SalesDBConnection");
if ( myconnect.GetError() == null )
{
myquery = "Select * from sales";
mycursor = myconnect.CreateCursor( myquery );
if ( myconnect.GetError() == null )
{
// Process the retrieved data
}
else dberror = true;
}
else dberror = true;
if ( dberror == true )
{
errobj = myconnect.GetError();
str = errobj.GetCode() + " " + errobj.GetMessage();
psDocument.Write ( str );
}