Consultor Eletrônico



Kbase 20840: How to Import Table Definitions to MS Access Using ActiveX Automation
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/10/2008
Status: Unverified

GOAL:

How to automatically achieve a migration of a Progress database to an ODBC data source (for example, Microsoft Access) in Progress Version 8.3B.

FACT(s) (Environment):

Progress 8.3x

FIX:

The code shown below allows you to automatically achieve a migration. The TransferDatabase action allows you to import (or export) data between a MS Access database and another database:

TransferDatabase ( [transfertType],
DatabaseType,
DatabaseName,
[ObjectType],
Source,
Destination,
[structureOnly],
[StoreLogin])

If importing the structure of the table and its data, the StructureOnly argument must be set to 0. The default value is -1. The optional StoreLogin argument (by default -1) is only necessary if linking the Progress table.

There is an easy way to get the correct ODBC connection string. Follow these steps:

1) From MS Access, link a Progress table.

2) Open the table in Design View.

3) View the table Properties.

The text in the Description property represents the ODBC
connection string.

The code follows:

DEFINE VARIABLE hAccess AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE cODBC AS CHARACTER NO-UNDO.

/* Connect to MS Access 2000 */
CREATE "Access.Application.9" hAccess CONNECT TO "C:\db1.mdb".

/* ODBC connection string */
cODBC =
"ODBC;DSN=pv83b;DB=sports;OIDP=TCP;OIDS=prosv02;OIDH=localhost;DBAM=Di
rect;DBPR=TCP;DBPA=E:\work\prgs\83\;DBOS=Windows;ASC=0;SR=1;GST=0;UID=
;" .

hAccess:Application:docmd:Transferdatabase(0,"ODBC
Database",cODBC,0,"customer","MyCustomer",-1).

RELEASE OBJECT hAccess.