OracleInfoMessageEventArgs Class

The OracleInfoMessageEventArgs class provides event data for the OracleConnection.InfoMessage event. When any warning occurs in the database, the OracleConnection.InfoMessage event is triggered along with the OracleInfoMessageEventArgs object that stores the event data.

Class Inheritance

System.Object

  System.EventArgs

    Oracle.DataAccess.Client.OracleInfoMessageEventArgs

Declaration

// C#
public sealed class OracleInfoMessageEventArgs

Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.

Example

// C#
 
using System;
using System.Data;
using Oracle.DataAccess.Client; 
using Oracle.DataAccess.Types;
 
 
class InfoMessageSample
{
  public static void WarningHandler(object src, 
    OracleInfoMessageEventArgs args)
  {
      Console.WriteLine("Source object is: " + src.GetType().Name);
      Console.WriteLine("InfoMessageArgs.Message is " + args.Message);
      Console.WriteLine("InfoMessageArgs.Source is " + args.Source);
  }
  static void Main()
  {
    OracleConnection con = new OracleConnection("User Id=scott;" + 
      "Password=tiger;Data Source=oracle;");
 
    con.Open();
 
    OracleCommand cmd = con.CreateCommand();
 
    //Register to the InfoMessageHandler
    cmd.Connection.InfoMessage += 
      new OracleInfoMessageEventHandler(WarningHandler);
 
    cmd.CommandText = 
      "create or replace procedure SelectWithNoInto( " +
      "  empname in VARCHAR2) AS " +
      "BEGIN " +
      "  select * from emp where ename = empname; " +
      "END SelectWithNoInto;";
 
    // Execute the statement that produces a warning
    cmd.ExecuteNonQuery();
 
    // Clean up
    cmd.Dispose();
    con.Dispose();
  }
}

Requirements

Namespace: Oracle.DataAccess.Client

Assembly: Oracle.DataAccess.dll

ODP.NET Version: ODP.NET for .NET Framework 2.0 or ODP.NET for .NET Framework 4


OracleInfoMessageEventArgs Members

OracleInfoMessageEventArgs members are listed in the following tables.

OracleInfoMessageEventArgs Static Methods

The OracleInfoMessageEventArgs static methods is listed in Table 5-68.

Table 5-68 OracleInfoMessageEventArgs Static Method

Method Description

Equals

Inherited from System.Object (Overloaded)


OracleInfoMessageEventArgs Properties

The OracleInfoMessageEventArgs properties are listed in Table 5-69.

Table 5-69 OracleInfoMessageEventArgs Properties

Property Description

Errors

Specifies the collection of errors generated by the data source

Message

Specifies the error text generated by the data source

Source

Specifies the name of the object that generated the error


OracleInfoMessageEventArgs Public Methods

The OracleInfoMessageEventArgs methods are listed in Table 5-70.

Table 5-70 OracleInfoMessageEventArgs Public Methods

Method Description

Equals

Inherited from System.Object (Overloaded)

GetHashCode

Inherited from System.Object

GetType

Inherited from System.Object

ToString

Inherited from System.Object



OracleInfoMessageEventArgs Static Methods

The OracleInfoMessageEventArgs static method is listed in Table 5-71.

Table 5-71 OracleInfoMessageEventArgs Static Method

Method Description

Equals

Inherited from System.Object (Overloaded)



OracleInfoMessageEventArgs Properties

The OracleInfoMessageEventArgs properties are listed in Table 5-72.

Table 5-72 OracleInfoMessageEventArgs Properties

Property Description

Errors

Specifies the collection of errors generated by the data source

Message

Specifies the error text generated by the data source

Source

Specifies the name of the object that generated the error


Errors

This property specifies the collection of errors generated by the data source.

Declaration

// C#
public OracleErrorCollection Errors {get;}

Property Value

The collection of errors.

Message

This property specifies the error text generated by the data source.

Declaration

// C#
public string Message {get;}

Property Value

The error text.

Source

This property specifies the name of the object that generated the error.

Declaration

// C#
public string Source {get;}

Property Value

The object that generated the error.


OracleInfoMessageEventArgs Public Methods

The OracleInfoMessageEventArgs methods are listed in Table 5-73.

Table 5-73 OracleInfoMessageEventArgs Public Methods

Method Description

Equals

Inherited from System.Object (Overloaded)

GetHashCode

Inherited from System.Object

GetType

Inherited from System.Object

ToString

Inherited from System.Object