Share via


SqlCeParameterCollection.Item Property (Int32)

Gets or sets the SqlCeParameter at the specified index.

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

Syntax

'Declaration
Public Default Property Item ( _
    index As Integer _
) As SqlCeParameter
'Usage
Dim instance As SqlCeParameterCollection
Dim index As Integer
Dim value As SqlCeParameter

value = instance(index)

instance(index) = value
public SqlCeParameter this [
    int index
] { get; set; 
public:
property SqlCeParameter^ default [int] {
    SqlCeParameter^ get (int index);
    void set (int index, SqlCeParameter^ value);
/** @property */
public SqlCeParameter get_Item (int index)

/** @property */
public void set_Item (int index, SqlCeParameter 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 SqlCeParameter at the specified index.

Exceptions

Exception type Condition

IndexOutOfRangeException

The index specified does not exist.

Remarks

The Item property is an indexer to the collection. To set the properties of a specific item, you reference the item by its number or name.

Example

The following example adds a SqlCeParameter object to SqlCeParameterCollection, and then sets the value of the first parameter (0 in the collection). This example assumes that a SqlCeCommand has already been created.

Dim da As New SqlCeDataAdapter()

Dim conn As New SqlCeConnection("Data Source = MyDatabase.sdf")
Dim cmd As New SqlCeCommand("SELECT * FROM Customers WHERE Country = @country", conn)

cmd.Parameters.Add("@country", SqlDbType.NVarChar, 15)
cmd.Parameters(0).Value = "UK"

da.SelectCommand = cmd
SqlCeDataAdapter da = new SqlCeDataAdapter();

SqlCeConnection conn = new SqlCeConnection("Data Source = MyDatabase.sdf");
SqlCeCommand cmd = new SqlCeCommand("SELECT * FROM Customers WHERE Country = @country", conn);

cmd.Parameters.Add("@country", SqlDbType.NVarChar, 15);
cmd.Parameters[0].Value = "UK";

da.SelectCommand = cmd;

.NET Framework Security

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Platforms

Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows XP Professional x64 Edition, Windows XP SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Version Information

.NET Compact Framework

Supported in: 2.0, 1.0

See Also

Reference

SqlCeParameterCollection Class
SqlCeParameterCollection Members
System.Data.SqlServerCe Namespace