Export (0) Print
Expand All

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)

JScript supports the use of indexed properties, but not the declaration of new ones.

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 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1

Community Additions

ADD
Show:
© 2015 Microsoft