DB2Parameter.Size Property
Gets or sets the maximum size, in bytes, of the data within the column.
- Namespace:
IBM.Data.DB2
- Assembly:
IBM.Data.DB2
(inIBM.Data.DB2.dll
)
Syntax
[Visual Basic]
Public Property Size As Integer Implements IDbDataParameter.Size
[C#]
public int Size {get; set;}
[C++]
public: __property int get_Size();
public: __property void set_Size(int);
[JScript]
public function get Size() : int;
public function set Size(int);
- Implements:
- IDbDataParameter.Size
Property value
The maximum size of the data to transmit to the server.
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 transmit to the server. For example, for a string value, the Size property could be used to limit the amount of data sent to the server to the first one hundred bytes.
For nonstring data types and ANSI string data, the Size property refers to the number of bytes. For Unicode string data, the Size property refers to the number of characters. The count for strings does not include the terminating character.
For output, bidirectional (inout), and return values, you must set the value of Size. This is not required for input parameters. If input parameters are not explicitly set, the value of Size will be inferred from the actual size of the specified parameter value.
For fixed-width data types, the value of Size is ignored.
Example
[Visual Basic, C#] The following example creates a DB2®Parameter and sets some of its properties.
[Visual Basic]
Public Sub CreateDB2Parameter()
Dim myValue As String = "12 foot scarf - multiple colors, one previous owner"
Dim myParameter As New DB2Parameter("Description", DB2Type.VarChar)
myParameter.Direction = ParameterDirection.Input
myParameter.Size = myValue.Length
myParameter.Value = myValue
End Sub 'CreateAdoParameter
[C#]
public void CreateDB2Parameter()
{
string myValue = "12 foot scarf - multiple colors, one previous owner";
DB2Parameter myParameter = new DB2Parameter("Description", DB2Type.VarChar);
myParameter.Direction = ParameterDirection.Input;
myParameter.Size = myValue.Length;
myParameter.Value = myValue;
}