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 returns the most recent error message stored in the named error object.
The following example connects to a database and retrieves some data. In this example, “mycursor” is a variable of type PSCursorClass, “myquery” is a variable of type String, “dberror” is a variable of type boolean, and “errobj” is a variable of type PSErrorClass. If an error occurs, GetMessage is called to get the error message:
PSConnectionClass myconnect = new PSConnectionClass(pageContext, "com.sybase.jdbc2.jdbc.SybDriver", "jdbc:sybase:Tds:localhost:2638", "dba","sql", true);
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 );
}