This documentation is archived and is not being maintained.

OdbcParameterCollection.Item Property (Int32)

Gets or sets the OdbcParameter at the specified index.

Namespace: System.Data.Odbc
Assembly: System.Data (in system.data.dll)

public OdbcParameter this [
	int index
] { get; set; }
/** @property */
public OdbcParameter get_Item (int index)

/** @property */
public void set_Item (int index, OdbcParameter value)

Not applicable.

Parameters

index

The zero-based index of the parameter to retrieve.

Property Value

The OdbcParameter at the specified index.

Exception typeCondition

IndexOutOfRangeException

The index specified does not exist.

The following example creates an OdbcParameterCollection, adds instances of OdbcParameter to the collection, displays the names of its OdbcParameter objects, and then clears the collection.

public void CreateParameterCollection(OdbcCommand command) 
{
    OdbcParameterCollection paramCollection = command.Parameters;
    paramCollection.Add("@CategoryName", OdbcType.Char);
    paramCollection.Add("@Description", OdbcType.Char);
    paramCollection.Add("@Picture", OdbcType.Binary);
    string paramNames = "";
    for (int i=0; i < paramCollection.Count; i++)
        paramNames += paramCollection[i].ToString() + "\n";
    Console.WriteLine(paramNames);
    paramCollection.Clear();
}

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1
Show: