DeviceToDesktop

DeviceToDesktop enables programmatic control over the conversion of ADOCE tables to .mdb files.

Syntax

DEVICETODESKTOP (DesktopLocn, TableList, Sync, Overwrite, DeviceLocn)

Parameters

DesktopLocn

Specifies the file name and path of the .mdb file to contain the converted tables or the Data Source Name (DSN) if ODBC support is enabled.

TableList

Specifies the list of tables converted and copied to the desktop computer. The following code example shows the form for TableList .

tablename<period><period>[tablename<period><period>]

If this is a zero-length string ("") or the argument is not provided, then the default copying of all tables is performed.

The simplest form of TableList is

Employees..

This code example shows how to copy the entire Employees table to the database file specified in the desktop computer location.

Because periods are not valid in table names, table names do not need to be delimited. Delimited table names are not supported.

Sync

Optional. If True, enables ActiveSync. False disables active sync. This parameter is not available in ADOCE 1.0 or 2.0.

Overwrite

Optional. True causes any tables with the same name in the desktop computer database to be overwritten. False causes an error to be generated, if a table of the same name already exists. True is the default.

DeviceLocn

Optional. Specifies the .cdb file that tables are copied from on the device. Not supported in ADOCE 1.0 or 2.0.

Remarks

The behavior of DeviceToDesktop parallels that of the Export from Mobile Device to Database dialog box, except that the user-choice dialog boxes do not appear. All progress bars appear, showing the transfer status. An error return does not cause the log file to automatically display. In the case of an error, the error value HRESULT is returned by the function and the calling application takes the appropriate action. In contrast to the DesktopToDevice function, there is no way to specify which fields are converted. All fields in a table are converted by default.

Example

The following code example shows a simple Visual Basic application that copies a subset of the Northwind database to the device with no synchronization, while overwriting any existing Northwind tables. Both the Employees and Products tables are sent in their entirety.

Declare Function DEVICETODESKTOP Lib "c:\program files\windows ce services\adofiltr.dll" _
(ByVal desktoplocn As String, _
        ByVal tablelist As String, _
        ByVal sync As Boolean, _
        ByVal overwrite As Integer, _
        ByVal devicelocn As String) As Long

result = DESKTOPTODEVICE("c:\mydbs\nwind.mdb", _
"!Employees..Products..", False, True, "")
If result <> 0 Then MsgBox "An error occurred transferring the data"