OracleParameter.Size OracleParameter.Size OracleParameter.Size OracleParameter.Size Property

定义

获取或设置列中的数据的最大大小(以字节为单位)。Gets or sets the maximum size, in bytes, of the data within the column.

public:
 virtual property int Size { int get(); void set(int value); };
public override int Size { get; set; }
member this.Size : int with get, set
Public Overrides Property Size As Integer

属性值

列中的数据的最大大小(以字节为单位)。The maximum size, in bytes, of the data within the column. 默认值为 0(在不想指定最大值时使用)。The default value is 0 (to be used when you do not want to specify the maximum size of the value).

实现

示例

下面的示例创建OracleParameter和设置的某些属性。The following example creates a OracleParameter and sets some of its properties.

Public Sub CreateOracleParameter()  
   Dim parameter As New OracleParameter("pDescription", OracleType.VarChar)  
   parameter.IsNullable = True  
   parameter.Direction = ParameterDirection.Output  
   parameter.Size = 88  
End Sub  
public void CreateOracleParameter()   
{  
   OracleParameter parameter = new OracleParameter("pDescription", OracleType.VarChar);  
   parameter.IsNullable = true;  
   parameter.Direction = ParameterDirection.Output;  
   parameter.Size = 88;  
}  

注解

设置Size影响仅输入参数的值。Setting Size affects only the input value of a parameter. 此属性不影响返回值和输出参数。Return values and output parameters are not affected by this property.

Size属性用于二进制和字符串类型。The Size property is used for binary and string types.

对于非字符串数据类型和 ANSI 字符串数据,Size属性引用的字节数。For nonstring data types and ANSI string data, the Size property refers to the number of bytes. 对于 Unicode 字符串数据,Size指的是字符数。For Unicode string data, Size refers to the number of characters. 字符串的计数不包括终止字符。The count for strings does not include the terminating character.

对于可变长度数据类型,Size描述的最大传输到服务器的数据量。For variable-length data types, Size describes the maximum amount of data to transmit to the server. 例如,对于 Unicode 字符串值,Size无法用于限制发送到服务器的前 100 个字符的数据量。For example, for a Unicode string value, Size could be used to limit the amount of data sent to the server to the first one hundred characters.

为双向参数、 输出参数和返回值,必须设置大小的值。For bidirectional and output parameters, and return values, you must set the value of Size. 这不是必需的输入参数,如果未显式设置时的值会从指定的参数的实际大小时推断执行参数化的语句。This is not required for input parameters, and if not explicitly set, the value of is inferred from the actual size of the specified parameter when a parameterized statement is executed.

DbTypeOracleType,并Size参数的属性,可以通过设置推断出ValueThe DbType, OracleType, and Size properties of a parameter can be inferred by setting Value. 因此,不需要指定它们。Therefore, you are not required to specify them. 但是,它们不会暴露在OracleParameter属性设置。However, they are not exposed in OracleParameter property settings. 例如,如果已推断出参数的大小,Size语句执行后,不包含推断的值。For example, if the size of the parameter has been inferred, Size does not contain inferred value after statement execution.

对于固定长度数据类型的值Size将被忽略。For fixed length 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 transmitting the value of the parameter to the server.

适用于