9. Understanding .NET Data Provider Connectivity : .NET Data Provider Classes : IngresErrorCollection Class
 
Share this page                  
IngresErrorCollection Class
The IngresErrorCollection class represents a collection of the IngresError objects returned by the Ingres database. Created by IngresException, an IngresErrorCollection collection always contains at least one instance of IngresError.
IngresErrorCollection Class Declaration
The declarations for the IngresErrorCollection class are:
C#: [Serializable]
  public sealed class IngresErrorCollection : ICollection, IEnumerable
VB.NET: <Serializable]>
NotInheritable Public Class IngresError
Inherits ICollection Implements IEnumerable
IngresErrorCollection Class Example
The following is an example implementation of the IngresErrorCollection class:
static void PrintErrorCollection(IngresErrorCollection errcol)
{
    foreach(IngresError err in errcol)
    {
        PrintError(err);
    }
    Console.WriteLine("");
}
 
static void PrintError(IngresError err)
{
    Console.Write(err.GetType().ToString() + ":\n");
 
    Console.Write("\t" + "Message = " +
        (err.Message !=null?
            err.Message.ToString() :"<null>") + "\n");
    Console.Write("\t" + "Source = " +
        (err.Source!=null?err.Source.ToString():"<null>") + "\n");
    Console.Write("\t" + "ToString: " + err.ToString() + "\n");
    Console.Write("\t" + "Number = " +
        (err.Number.ToString()) + "\n");
    Console.Write("\t" + "SQLState = " +
        (err.SQLState !=null?
            err.SQLState.ToString() :"<null>") + "\n");
    Console.WriteLine("");
}
IngresErrorCollection Class Properties
The IngresErrorCollection class has the following properties:
Property
Accessor
Description
Count
get
The number of errors in the collection.
Item
get
Gets the IngresError for a given ordinal. This property is the C# indexer for IngresErrorCollection class.
IngresErrorCollection Class Public Methods
The public methods available to the IngresErrorCollection class are:
Method
Description
CopyTo
Copies the elements of IngresErrorCollection to an Array.