SqlCeParameterCollection.Item Property (String)
Gets or sets the SqlCeParameter with the specified name.
Namespace: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in system.data.sqlserverce.dll)
Syntax
'Declaration
Public Default Property Item ( _
parameterName As String _
) As SqlCeParameter
'Usage
Dim instance As SqlCeParameterCollection
Dim parameterName As String
Dim value As SqlCeParameter
value = instance(parameterName)
instance(parameterName) = value
public SqlCeParameter this [
string parameterName
] { get; set; }
public:
property SqlCeParameter^ default [String^] {
SqlCeParameter^ get (String^ parameterName);
void set (String^ parameterName, SqlCeParameter^ value);
}
/** @property */
public SqlCeParameter get_Item (String parameterName)
/** @property */
public void set_Item (String parameterName, SqlCeParameter value)
Not applicable.
Parameters
- parameterName
The name of the parameter to retrieve.
Property Value
The SqlCeParameter with the specified name.
Exceptions
Exception type | Condition |
---|---|
The name 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;
Platforms
Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows XP Professional x64 Edition, Windows XP SP2
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Version Information
.NET Framework
Supported in: 3.0
.NET Compact Framework
Supported in: 2.0, 1.0
See Also
Reference
SqlCeParameterCollection Class
SqlCeParameterCollection Members
System.Data.SqlServerCe Namespace