共用方式為


SqlCeParameterCollection.Add Method (String, SqlDbType)

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

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

Syntax

'Declaration
Public Function Add ( _
    parameterName As String, _
    type As SqlDbType _
) As SqlCeParameter
'Usage
Dim instance As SqlCeParameterCollection
Dim parameterName As String
Dim type As SqlDbType
Dim returnValue As SqlCeParameter

returnValue = instance.Add(parameterName, type)
public SqlCeParameter Add (
    string parameterName,
    SqlDbType type
)
public:
SqlCeParameter^ Add (
    String^ parameterName, 
    SqlDbType type
)
public SqlCeParameter Add (
    String parameterName, 
    SqlDbType type
)
public function Add (
    parameterName : String, 
    type : SqlDbType
) : SqlCeParameter
Not applicable.

Parameters

  • parameterName
    The name of the parameter.
  • type
    One of the SqlDbType values.

Return Value

A reference to the new SqlCeParameter object.

Example

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

Dim p1 As SqlCeParameter = cmd.Parameters.Add("@Description", SqlDbType.NVarChar)
p1.Size = 16
p1.Value = "Beverages"
SqlCeParameter p1 = cmd.Parameters.Add("@Description", SqlDbType.NVarChar);
p1.Size = 16;
p1.Value = "Beverages";

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