DataSessionID Property

Applies To   See Also

Returns the data session ID that identifies the private data session for the form set, form, or toolbar. Read-only at design time; read-write at run time.

If the DataSession property of the form, form set, or toolbar is set to 1 (Default Data Session), returns the default data session ID.

Syntax

Object.DataSessionID

Remarks

Available only if the form set, form, or toolbar's DataSession property is set to 2 (Private data session).

You can use SET DATASESSION with the DataSessionID property to change data sessions.

When you set DataSessionID, the setting affects the working data session for the object and all the objects it contains. The DataSessionID property setting does not affect noncontained objects or objects created using CREATEOBJECT( ).

Changing the DataSessionID property setting increments the reference count of the data session changed to and decrements the reference count of the data session changed from. However, if a data session is created by setting the DataSession property to 2 (Private data session), changing the DataSessionID property setting does not release the initial data session. In such case, the object must be released to free the initial session.

For more information on multiple data sessions, see Chapter 17, Programming for Shared Access, in the Programmer's Guide.

Caution   Changing the DataSessionID property setting of an object that contains data-bound controls causes the controls to lose their original data sources. In general, use DataSessionID on objects that do not contain data-bound controls.