AdsException

Advantage .NET Data Provider

  Previous topic Next topic  

Full name: Advantage.Data.Provider.AdsException

Inherits: System.SystemException

 

Properties

The Advantage .NET Data Provider throws AdsException exceptions when errors specific to the provider are generated. For example, if an error is returned by the Advantage Database Server when executing an SQL statement, the Advantage .NET Data Provider will throw an AdsException.

Example

try

{

AdsConnection conn = new AdsConnection( "data source = c:\\data;" );

AdsCommand cmd;

 

conn.Open();

// create a command with a syntax error

cmd = new AdsCommand( "update bad statement", conn );

// execute the query (will throw an exception)

Console.WriteLine( "Records affected: " + cmd.ExecuteNonQuery() );

 

}

catch ( AdsException e )

{

// print the exception information

Console.WriteLine( "Error Number: " + e.Number );

Console.WriteLine( "Error State: " + e.State );

Console.WriteLine( "Message: " + e.Message );

}

catch ( Exception e )

{

// handle non-Advantage-specific exceptions

Console.WriteLine( e.Message );

}

See Also

AdsInfoMessageEventArgs