CreateDynaset Method (Professional Edition Only)

See AlsolanCreateDynasetSee                 ExamplelanCreateDynasetEx>Low

Description

Creates a Dynaset objectUDR386 from a specified Table3N276AP object, QueryDef19G3DMW object, or SQL statement29F05E5.

Syntax

Set dynasetobject = database.CreateDynaset( source [, options ] )

Set dynasetobject = recordset | querydef }.CreateDynaset( [ options ] )

Remarks

The CreateDynaset method uses these parts:

Part                 Description

 

dynasetobject   Object variableZ3R9Q5 of type Dynaset.

database          Object variable identifying an open database or the Database property of a data control.

recordset          Object variable identifying an existing recordset22S7WAF object or the Recordset property of a data control.

querydef           Object variable identifying an existing QueryDef object.

source              String expression1330R89 that is the name of an existing recordset, QueryDef or SQL statement.

options             A numeric expression71RISN indicating one or more option settings.  Values can be combined by adding them together.  See table below for option values.

 

You can supply one or a combination of the following symbolic constants and values (from DATACONS.TXT) in the options part:

Constant                                Value      Description

 

DB_DENYWRITE                       1          In a multiuser or multitasking environment, others cannot make changes to any records in any table in your Dynaset while you have it open.  Use for administrative purposes only.

DB_READONLY                         4          You cannot make changes to records in your Dynaset.  This can increase speed of some operations.

DB_APPENDONLY                     8          You can only add new records to the Dynaset.  You cannot read or update existing records.

DB_INCONSISTENT                  16        Updates can apply to all fields of the Dynaset, even if they also affect other rows of the Dynaset.

DB_CONSISTENT                     32        (Default) Updates apply only to those fields that will not affect other rows of the Dynaset.

DB_SQLPASSTHROUGH           64        For Dynasets created with an SQL statement, this value causes the SQL statement to be passed to an ODBC database for processing, as when creating a Dynaset on tables in a SQL Server or Oracle database.  Ignored except for ODBC remote databases.  The Dynaset is not updatable.

 

If both DB_INCONSISTENT and DB_CONSISTENT are included, or if neither are included, the result is the default.

When applied to a Dynaset or Snapshot1ZLURBC, CreateDynaset returns a new Dynaset containing records filtered and sorted according to the Dynaset's or Snapshot's Filter and Sort properties.  It doesn't affect the contents of the first Dynaset or Snapshot.

To create a Dynaset from a QueryDef that has parameters, open the QueryDef, set the parameters, and then use CreateDynaset.  You set the parameters of a QueryDef using the following syntax:

querydef ! parameter = parametervalue

When you only want to read data and not change data, a Snapshot object is faster than a read-only Dynaset object.  However, a read-only Dynaset will reflect changes made by others while you are using it.  A Snapshot will not.

 

Note   If your program requires two identical Dynasets, it is more efficient to create a single Dynaset and then use the Clone method to create a second reference.