CursorFill Method

Executes the command in the SelectCmd Property property against the data source in the CursorAdapter DataSource property, creates a cursor, retrieves data, and performs any necessary data conversion according to the CursorAdapter DataSourceType Property and CursorSchema Property properties.

CursorAdapter.CursorFill( [ lUseCursorSchema [, lNoData [, nOptions [, Source ] ] ] ] )

Parameters

lUseCursorSchema

The following table lists the values for lUseCursorSchema.

lUseCursorSchema Description

True (.T.)

Uses the schema in the CursorSchema property to create the cursor.

NoteNote

Visual FoxPro generates error messages when CursorSchema is required but is missing or invalid.

False (.F.) or empty

Does not use the schema in the CursorSchema property to create the cursor.

Instead, CursorFill creates the cursor using the data types as normally determined by Visual FoxPro according to the CursorAdapter DataSourceType property.

lNoData

The following table lists the values for lNoData.

lNoData Description

True (.T.)

Create the cursor but do not fill it with data.

When the CursorAdapter DataSourceType property is "ADO", and SelectCmd contains parameters, CursorFill attempts to evaluate the parameters in SelectCmd. If CursorFill cannot evaluate the parameters, it uses null (.NULL.) values for the parameter values.

When the CursorAdapter DataSourceType property is "XML", CursorFill creates the cursor using the schema in the CursorSchema property, regardless of the value passed to lUseCursorSchema. If CursorSchema is empty or invalid, Visual FoxPro generates an error.

False (.F.) or empty

Create the cursor and fill it with data.

If you specify lNoData for CursorFill, and SelectCmd is a SQL SELECT - SQL Command command against a parameterized view, Visual FoxPro continues to prompt you for parameter input. This action is equivalent to the following statement:

 CopyCode imageCopy Code
SELECT * FROM "customers in specific country" WHERE 1=0
nOptions

Specifies numeric values or flags for creating the cursor. The values for nOptions are also used for the CursorRefresh method.

The following table lists values for nOptions depending on the setting of the CursorAdapter DataSourceType property.

DataSourceType nOptions

"ADO"

An integer representing the Command type or Execution Enum values you want to set for the ActiveX Data Object (ADO) RecordSet Open method. The default value is -1.

"XML"

Any combination of valid XMLTOCURSOR( ) Function function flags except 8192, which is automatically set when the lUseCursorSchema parameter contains a value of True (.T.).

Source

Specifies a reference to an ADO Command or an open RecordSet object.

The ADO Command object must have its ActiveConnection property set to the appropriate and already open ADO Connection object. When an ADO Command object is passed to Source, Visual FoxPro sets the ADO Command CommandText property to value of the CursorAdapter SelectCmd property. Visual FoxPro parses any parameters in SelectCmd, and creates and sets parameter values in the ADO Command object. CursorFill method then executes in the following manner:

 CopyCode imageCopy Code
CursorAdapter.DataSource.Open( Source,,,,Options )

In this call, DataSource is the ADO RecordSet object in the CursorAdapter DataSource property, and Source is the ADO Command object referenced in this parameter.

The ADO RecordSet object must be open when passed to Source, CursorFill executes against the ADO RecordSet object and populates the cursor accordingly. In this case, only the CursorAdapter DataSourceType property must be set to "ADO". The CursorAdapter SelectCmd and DataSource properties are not used.

If you do not specify a value for Source, CursorFill executes in the following manner:

 CopyCode imageCopy Code
CursorAdapter.DataSource.Open( CursorAdapter.SelectCmd,,,,Options )

In this call, DataSource is the ADO RecordSet object in the CursorAdapter DataSource property. However, the ADO RecordSet object directly executes the current CursorAdapter SelectCmd property instead of using an ADO Command object. The ADO RecordSet must have its ActiveConnection property set to a valid ADO Connection object.

Expand imageReturn Value

Expand imageRemarks

Expand imageSee Also


© , 1996-2020 • Updated: 11/10/20
Comment or report problem with topic