Microsoft SDK for Java

append

The append method appends an object to a Fields or Parameters collection. append has the following signatures:

append(String name, int type)
append(String name, int type, int definedSize)
append(String name, int type, int definedSize, int attrib)

Parameter Types

You must set the type of a Parameter object before appending it to the Parameters collection. If you select a variable-length data type, you must also set the size to a value greater than zero.

Describing parameters yourself minimizes calls to the provider and consequently improves performance when using stored procedures or parameterized queries. However, you must know the properties of the parameters associated with the stored procedure or parameterized query you want to call.

Use the createParameter method to create Parameter objects with the appropriate property settings and use the append method to add them to the Parameters collection. This lets you set and return parameter values without having to call the provider for the parameter information. If you are writing to a provider that does not supply parameter information, you must manually populate the Parameters collection using this method to be able to use parameters at all.

Fields

If the collection is Fields, a new Field object may be created before it is appended to the collection.

The FieldValue parameter is only valid when adding a Field object to a Record object; not to a Recordset object. With a Record object, you may append fields and provide values at the same time. With a Recordset object, you must create fields while the Recordset is closed, then open the Recordset and assign values to the fields.

Recordset

If you do not set the CursorLocation value before calling the append method, CursorLocation will be set to CLIENT automatically when the Recordset object's open method is called.

A runtime error will occur if the append method is called on the Fields collection of an open Recordset, or a Recordset where activeConnection has been set. You can only append fields to a Recordset that is not open and has not yet been connected to a data source. This is typically the case when a Recordset object is fabricated with the createParameter method or assigned to an object variable.

append(String name, int type)

Appends an object to a Fields or Parameters collection.

Syntax

public void append(String name, int type);

Parameters

name A String that contains the name of the new Field object, and must not be the same name as any other object in fields.
type A DataType value, whose default value is EMPTY, that specifies the data type of the new field. The following data types are not supported by ADO, and should not be used when appending new fields to a Recordset: IDispatch, IUnknown, and Variant.

append(String name, int type, int definedSize)

Appends an object to a Fields or Parameters collection.

Syntax

public void append(String name, int type, int definedSize);

Parameters

name A String that contains the name of the new Field object, and must not be the same name as any other object in fields.
type A DataType value, whose default value is EMPTY, that specifies the data type of the new field. The following data types are not supported by ADO, and should not be used when appending new fields to a Recordset: IDispatch, IUnknown, and Variant.
definedSize Optional. A Long value that represents the defined size, in characters or bytes, of the new field. The default value for this parameter is derived from getType. (The default DefinedSize is unspecified.)

append(String name, int type, int definedSize, int attrib)

Appends an object to a Fields or Parameters collection.

Syntax

public void append(String name, int type, int definedSize, int attrib);

Parameters

name A String that contains the name of the new Field object, and must not be the same name as any other object in fields.
type A DataType value, whose default value is EMPTY, that specifies the data type of the new field. The following data types are not supported by ADO, and should not be used when appending new fields to a Recordset: IDispatch, IUnknown, and Variant.
definedSize Optional. A value that represents the defined size, in characters or bytes, of the new field. The default value for this parameter is derived from getType. (The default DefinedSize is unspecified.)
attrib Optional. A FieldAttribute value, whose default value is DEFAULT, that specifies attributes for the new field. If this value is not specified, the field will contain attributes derived from Type.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.