Advantage Developer Zone

 
 
 

Using the Advantage OLE DB Provider with ADO

Friday, July 14, 2006

The Advantage OLE DB Provider allows ADO to access data via an Advantage Database Server or Advantage Local Server. The Advantage OLE DB Provider supports the ADO 2.1 specification.

Using the Advantage OLE DB Provider with ADO

The Advantage OLE DB Provider allows ADO to access data via an Advantage Database Server or Advantage Local Server. The Advantage OLE DB Provider supports the ADO 2.1 specification.

Connection String Parameters

To connect to this provider, set the Provider argument of the ConnectionString property to either:

Advantage OLE DB Provider or Advantage.OLEDB.1

Reading the Provider property will return the string:

Advantage.OLEDB.1

Typical Connection String

A typical connection string for the Advantage OLE DB Provider is:

Provider=Advantage OLE DB Provider; Data Source=DatabaseDirectory

Consisting of the following keywords:

Keyword
Description

Provider

Specifies the Advantage OLE DB Provider.

Data Source

Specifies the fully qualified database path where the data files exist (for example, x:\data\tables).

Provider-Specific Connection Parameters

The Advantage OLE DB Provider supports several provider-specific connection parameters in addition to those defined by ADO. As with all other connection parameters, they can be set via the Connection object's Properties collection or as part of the connection string. Available provider-specific connection parameters are:

Parameter
Description
TableType

Specifies the desired table type. Valid values include ADS_ADT and ADS_CDX. The default is ADS_ADT.

ServerType

Specifies the Advantage server types in which to connect. Valid values include ADS_REMOTE_SERVER, ADS_AIS_SERVER, and ADS_LOCAL_SERVER. These values can be logically ORed together with the vertical bar character | in order to choose multiple server types. The default is ADS_REMOTE_SERVER | ADS_AIS_SERVER. If multiple types are specified and multiple server types are available, the order of precedence is ADS_REMOTE_SERVER first, ADS_AIS_SERVER second, and ADS_LOCAL_SERVER third.

LockMode

Specifies the locking mode to use. Valid values include ADS_PROPRIETARY_LOCKING and ADS_COMPATIBLE_LOCKING. The default is ADS_PROPRIETARY_LOCKING.

SecurityMode

Specifies the security mode to use. Valid values include ADS_CHECKRIGHTS and ADS_IGNORERIGHTS. The default is ADS_CHECKRIGHTS.

ShowDeleted

Specifies whether deleted records in DBF tables are visible. Valid values are TRUE or FALSE. This setting is only applicable to the ADS_CDX TableType option. If set to TRUE, deleted records in the DBF table will be visible. The default is FALSE.

CharType

Specifies whether the data in the tables is ANSI or OEM. Valid values include ADS_ANSI and ADS_OEM. The default is ADS_ANSI.

For example, to specify that the provider is to use Advantage Local Server and FoxPro tables, you could use the ADO connection string specified below. Note the provider name can be specified by either its friendly name,Advantage OLE DB Provider, or by it's official registry name, Advantage.OLEDB.1:

Provider=Advantage OLE DB Provider; Data Source=z:\data\tables; ServerType=ADS_LOCAL_SERVER; TableType=ADS_CDX;