System.Data.OleDb Namespace OleDbParameter Class
Sets or retrieves the maximum size of the parameter data.
Script |
OleDbParameter.Size [ = bytes ] |
bytes |
The maximum size, in bytes, of the data within the column. |
The property is read/write with a default value inferred from the the parameter Value.
The maximum parameter size of the data.
IDbDataParameter.Size
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, the Size property can be used to limit the amount of data sent to the server for a string value 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.
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 utilizes when transmitting the value of the parameter to the server.
The following example initializes an OleDbParameter and sets some of its properties.
public void CreateOleDbParameter ( ) {
string myValue = "12 foot scarf - multiple colors, one previous owner";
OleDbParameter myParam = new OleDbParameter ( "Description", OleDbType.VarChar );
myParam.Direction = ParameterDirection.Output;
myParam.Value = myValue;
myParam.Size = myValue.Length;
}
Public Sub CreateOleDbParameter ( )
Dim myValue As String = "12 foot scarf - multiple colors, one previous owner"
Dim myParam As new OleDbParameter ( "Description", OleDbType.VarChar )
myParam.Direction = ParameterDirection.Output
myParam.Value = myValue
myParam.Size = myValue.Length
End Sub |
|
C# |
VB |
OleDbParameter Members