OdbcParameterCollection.Item Property (Int32)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the OdbcParameter at the specified index.

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

<BrowsableAttribute(False)>
Public Property Item (
	index As Integer
) As OdbcParameter

Parameters

index
Type: System.Int32

The zero-based index of the parameter to retrieve.

Property Value

Type: System.Data.Odbc.OdbcParameter

The OdbcParameter at the specified index.

Exception Condition
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 Sub CreateParameterCollection(command As OdbcCommand)
    Dim paramCollection As OdbcParameterCollection = _
        command.Parameters
    paramCollection.Add("@CategoryName", OdbcType.Char)
    paramCollection.Add("@Description", OdbcType.Char)
    paramCollection.Add("@Picture", OdbcType.Binary)
    Dim paramNames As String = ""
    Dim i As Integer
    For i = 0 To paramCollection.Count - 1
        paramNames += paramCollection(i).ToString() & _
            ControlChars.Cr
    Next i
    Console.WriteLine(paramNames)
    paramCollection.Clear()
End Sub 

.NET Framework
Available since 1.1
Return to top
Show: