Occurs when Advantage .NET Data Provider receives a progress report from the Advantage Database Server on a currently executing SQL statement.
public event AdsInfoMessageEventHandler ProgressMessage;
This event provides the ability for an application to register a delegate function to receive progress callbacks during SQL statement execution. This can provide equivalent functionality to the AdsCommand.Progress property but does not require a separate thread to monitor the progress. The provider will fire an event each time it receives a progress update from the server, which is generally every 2 seconds.
The event handler receives an argument of type AdsInfoMessageEventArgs containing data related to this event. The relevant data is the Number property, which contains the estimated percentage of the execution progress.
// Provide an event handler for InfoMessage events
protected static void OnProgressMessage( object sender, AdsInfoMessageEventArgs args )
// Do something with the information
Console.WriteLine( "Progress: " + args.Number.ToString() );
// Cancel the execution based on some decision may look like this:
// if ( <cancelcondition> )
static public void ProgressMessageTest()
AdsConnection conn = null;
AdsCommand cmd = null;
AdsTransaction txn = null;
// get a connection and begin a transaction
conn = new AdsConnection( "data source = c:\\data;" );
txn = conn.BeginTransaction();
// use a statement that takes a while to finish
cmd = new AdsCommand( "UPDATE bigtable SET deptnum = 7", conn );
// set command so that it will not time out
cmd.CommandTimeout = 0;
// Add our delegate function as a listener for progress events
cmd.ProgressMessage += new AdsInfoMessageEventHandler( OnProgressMessage );
// Execute the statement.
Console.WriteLine( cmd.ExecuteNonQuery() + " Records Affected" );
// Completed without being cancelled
catch ( Exception e )
if ( txn != null )
Console.WriteLine( e.Message );
if ( conn != null )