Condividi tramite


SqlCeParameterCollection.Add Method

Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Adds a SqlCeParameter to the SqlCeCommand.

Overload List

Adds a SqlCeParameter object to the SqlCeCommand.

Supported only by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Function Add(Object) As Integer Implements IList.Add

[C#] public virtual int Add(object);

[C++] public: virtual int Add(Object*);

[JScript] public function Add(Object) : int;

Adds the specified SqlCeParameter to the SqlCeParameterCollection.

Supported only by the .NET Compact Framework.

[Visual Basic] Overloads Public Function Add(SqlCeParameter) As SqlCeParameter

[C#] public SqlCeParameter Add(SqlCeParameter);

[C++] public: SqlCeParameter* Add(SqlCeParameter*);

[JScript] public function Add(SqlCeParameter) : SqlCeParameter;

Adds a SqlCeParameter to the SqlCeParameterCollection given the parameter name and value.

Supported only by the .NET Compact Framework.

[Visual Basic] Overloads Public Function Add(String, Object) As SqlCeParameter

[C#] public SqlCeParameter Add(string, object);

[C++] public: SqlCeParameter* Add(String*, Object*);

[JScript] public function Add(String, Object) : SqlCeParameter;

Adds a SqlCeParameter to the SqlCeParameterCollection given the parameter name and data type.

Supported only by the .NET Compact Framework.

[Visual Basic] Overloads Public Function Add(String, SqlDbType) As SqlCeParameter

[C#] public SqlCeParameter Add(string, SqlDbType);

[C++] public: SqlCeParameter* Add(String*, SqlDbType);

[JScript] public function Add(String, SqlDbType) : SqlCeParameter;

Adds a SqlCeParameter to the SqlCeParameterCollection given the the parameter name, data type, and column width.

Supported only by the .NET Compact Framework.

[Visual Basic] Overloads Public Function Add(String, SqlDbType, Integer) As SqlCeParameter

[C#] public SqlCeParameter Add(string, SqlDbType, int);

[C++] public: SqlCeParameter* Add(String*, SqlDbType, int);

[JScript] public function Add(String, SqlDbType, int) : SqlCeParameter;

Adds a SqlCeParameter to the SqlCeCommand given the parameter name, data type, column width, and source column name.

Supported only by the .NET Compact Framework.

[Visual Basic] Overloads Public Function Add(String, SqlDbType, Integer, String) As SqlCeParameter

[C#] public SqlCeParameter Add(string, SqlDbType, int, string);

[C++] public: SqlCeParameter* Add(String*, SqlDbType, int, String*);

[JScript] public function Add(String, SqlDbType, int, String) : SqlCeParameter;

Example

[Visual Basic, C#, C++] The following example adds new element to a SqlCeParameterCollection. It assumes that a SqlCeCommand has already been created.

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of Add. For other examples that might be available, see the individual overload topics.

  [Visual Basic] 
Public Sub AddSqlCeParameter(ByVal cmd As SqlCeCommand)
    cmd.Parameters.Add("@Description", "Beverages")
End Sub

[C#] 
public void AddSqlCeParameter(SqlCeCommand cmd) {
    cmd.Parameters.Add("@Description", "Beverages");
}

[C++] 
public:
    void AddSqlCeParameter(SqlCeCommand* cmd)
    {
        cmd->Parameters->Add(S"@Description", S"Beverages");
    };

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

SqlCeParameterCollection Class | SqlCeParameterCollection Members | System.Data.SqlServerCe Namespace

Syntax based on .NET Framework version 1.1.
Documentation version 1.1.1.

Send comments on this topic.

© Microsoft Corporation. All rights reserved.