ADOCodePage Property

Visual Studio 2005

Specifies a code page for the CursorAdapter object to use during character data translation when working with ADO data. Read/write at design time and run time.

CursorAdapter.AllowInsert [ = nCodePage ]


The code page (integer) to use for character data translation when using ADO data sources. An error will occur if you try to set an invalid code page. The default setting is 0.

Applies To: CursorAdapter Class

The code page specified by the ADOCodePage property is used to translate for the following commands:

  • Select

  • Insert

  • Update

  • Delete

  • ConflictCheck

  • InsertRefresh

  • UpdateRefresh

  • Refresh

  • FetchMemo

It is also used with all character parameters passed to and from the ADO data source.

After a CursorFill or CursorRefresh method call, the opened cursor becomes bound to the code page specified by the ADOCodePage property at the time the cursor is filled or refreshed. This means that regardless of the current ADOCodePage setting, all character data fetched from the data source are translated using the bound code page. This includes normal fetch process, fetch during auto-refresh, on demand refresh, and delayed memo fetch.

You can only bind a code page (as specified by ADOCodePage) to an ADO-based cursor. However, ADOCodePage can still be used with non ADO-based cursors. When a non ADO-based cursor is attached to a CursorAdapter object, the ADOCodePage setting is used to translate character data fetched during auto-refresh, on demand refresh and delayed memo fetch.

A cursor can be rebound to a different code page by changing the ADOCodePage property and executing the CursorRefresh Method.

You can retrieve the code page associated with a ADO-based cursor by passing "ADOCodePage" as parameter to the CURSORGETPROP( ) Function.

If a code page other than 0 is used to translate a parameter and the CursorAdapter creates the parameter (the Parameters.Refresh method fails to create it), the parameter is created as adVarWChar/adLongVarWChar rather than adVarChar/adLongVarChar.

Community Additions