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
Object
EventArgs
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
OracleInfoMessageEventArgs members are listed in the following tables:
OracleInfoMessageEventArgs Static Methods
The OracleInfoMessageEventArgs static methods is listed in Table 5-63.
Table 5-63 OracleInfoMessageEventArgs Static Method
| Method | Description |
|---|---|
Equals |
Inherited from Object (Overloaded) |
OracleInfoMessageEventArgs Properties
The OracleInfoMessageEventArgs properties are listed in Table 5-64.
Table 5-64 OracleInfoMessageEventArgs Properties
| Name | 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-65.
Table 5-65 OracleInfoMessageEventArgs Public Methods
| Name | Description |
|---|---|
Equals |
Inherited from Object (Overloaded) |
GetHashCode |
Inherited from Object |
GetType |
Inherited from Object |
ToString |
Inherited from Object |
The OracleInfoMessageEventArgs static method is listed in Table 5-66.
Table 5-66 OracleInfoMessageEventArgs Static Method
| Method | Description |
|---|---|
Equals |
Inherited from Object (Overloaded) |
The OracleInfoMessageEventArgs properties are listed in Table 5-67.
Table 5-67 OracleInfoMessageEventArgs Properties
| Name | 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 |
This property specifies the collection of errors generated by the data source.
Declaration
// C#
public OracleErrorCollection Errors {get;}
Property Value
The collection of errors.
This property specifies the error text generated by the data source.
Declaration
// C#
public string Message {get;}
Property Value
The error text.
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.
The OracleInfoMessageEventArgs methods are listed in Table 5-68.