Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Gilt für: Access 2013, Office 2013
Dieses Beispiel löst einen Fehler aus, fängt ihn auf und zeigt die Eigenschaften Description, HelpContext, HelpFile, NativeError, Number, Source und SQLState des resultierenden Error-Objekts an.
// BeginDescriptionJ
// The WFC class includes the ADO objects.
import com.ms.wfc.data.*;
import java.io.* ;
public class DescriptionX
{
// The main entry point for the application.
public static void main (String[] args)
{
DescriptionX();
System.exit(0);
}
// DescriptionX function
static void DescriptionX()
{
// Declarations.
BufferedReader in = new
BufferedReader(new InputStreamReader(System.in));
// Define ADO Objects.
Connection cnConn1 = null;
try
{
// Intentionally trigger an error.
cnConn1 = new Connection();
cnConn1.open("nothing");
}
catch( AdoException ae )
{
// Notify user of any errors that result from ADO.
PrintProviderError(cnConn1);
}
try
{
System.out.println("\nPress <Enter> key to continue.");
in.readLine();
}
// System read requires this catch.
catch( java.io.IOException je)
{
PrintIOError(je);
}
}
// PrintProviderError Function
static void PrintProviderError( Connection Cnn1 )
{
// Print Provider errors from Connection object.
// ErrItem is an item object in the Connections Errors collection.
com.ms.wfc.data.Error ErrItem = null;
long nCount = 0;
int i = 0;
nCount = Cnn1.getErrors().getCount();
// If there are any errors in the collection, print them.
if( nCount > 0);
{
// Collection ranges from 0 to nCount - 1
for (i = 0; i< nCount; i++)
{
ErrItem = Cnn1.getErrors().getItem(i);
System.out.println("\t Error number: " + ErrItem.getNumber()
+ "\t" + ErrItem.getDescription() );
}
}
}
// PrintIOError Function
static void PrintIOError( java.io.IOException je)
{
System.out.println("Error \n");
System.out.println("\tSource = " + je.getClass() + "\n");
System.out.println("\tDescription = " + je.getMessage() + "\n");
}
}
// EndDescriptionJ