Share via


Add Method (Object)

Adds a SqlCeParameter object to the SqlCeCommand.

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

Syntax

'Declaration
Public Overrides Function Add ( _
    value As Object _
) As Integer
'Usage
Dim instance As SqlCeParameterCollection
Dim value As Object
Dim returnValue As Integer

returnValue = instance.Add(value)
public override int Add(
    Object value
)
public:
virtual int Add(
    Object^ value
) override
abstract Add : 
        value:Object -> int 
override Add : 
        value:Object -> int 
public override function Add(
    value : Object
) : int

Parameters

Return Value

Type: System. . :: . .Int32
The index of the new SqlCeParameter object in the collection.

Implements

IList. . :: . .Add(Object)

Exceptions

Exception Condition
InvalidCastException

The parameter passed was not a SqlCeParameter.

Examples

The following example adds a SqlCeParameter object to a SqlCeParameterCollection. It assumes that a SqlCeCommand has already been created.

Dim pIndex As Integer = cmd.Parameters.Add(CType(New SqlCeParameter("Description", "Beverages"), [Object]))
int pIndex = cmd.Parameters.Add((Object)new SqlCeParameter("Description", "Beverages"));

See Also

Reference

SqlCeParameterCollection Class

SqlCeParameterCollection Members

Add Overload

System.Data.SqlServerCe Namespace