Condividi tramite


SqlCeParameter.Size Property

Gets or sets the maximum length of the data within the column.

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

Syntax

'Declaration
Public Overrides Property Size As Integer
'Usage
Dim instance As SqlCeParameter
Dim value As Integer

value = instance.Size

instance.Size = value
public override int Size { get; set; }
public:
virtual property int Size {
    int get () override;
    void set (int value) override;
}
/** @property */
public int get_Size ()

/** @property */
public void set_Size (int value)
public override function get Size () : int

public override function set Size (value : int)
Not applicable.

Property Value

The maximum length of the data within the column. The default value is inferred from the parameter value.

Remarks

The Size property is used for binary and string types.

For variable-length data types, the Size property describes the maximum amount of data to send to the server. For example, the Size property can be used to limit the amount of data sent to the server for a string value to the first 100 bytes.

For Unicode string data, the Size property refers to the number of characters. The count for strings does not include the terminating character.

If not explicitly set, the size is inferred from the actual size of the specified parameter value.

For fixed-width data types, the value of Size is ignored. It can be retrieved for informational purposes, and returns the maximum amount of bytes the provider uses when sending the value of the parameter to the server.

Example

The following example creates a SqlCeParameter and sets the Size property.

Dim param As New SqlCeParameter("@Description", SqlDbType.NVarChar)
param.IsNullable = True
param.Size = 88
SqlCeParameter param = new SqlCeParameter("@Description", SqlDbType.NVarChar);
param.IsNullable = true;
param.Size = 88;

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

SqlCeParameter Class
SqlCeParameter Members
System.Data.SqlServerCe Namespace