Returns the next error object, if one exists.
PSErrorClass objects
errorobject.GetNextError( )
Argument |
Description |
---|---|
errorobject |
A variable that contains a reference to an instance of PSErrorClass |
PSErrorClass object. If multiple error objects exist, returns an instance of PSErrorClass for the next error object. If no more error objects exist, it returns null.
At runtime, GetNextError returns the next error 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, a GetNextError call accesses the list of error objects. For each error object, it writes out the error code and message text:
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();
{
while ( errobj != null )
{
str = errobj.GetCode() + " " + errobj.GetMessage();
psDocument.WriteLn ( str );
errobj = errobj.GetNextError();
}
}