DeviceToDesktop

DeviceToDesktop enables programmatic control over the conversion of ADOCE tables to .mdb files. Its behavior 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 do appear, showing the transfer status. An error return does not cause the log file to automatically display. Instead, an error value, which is the offending HRESULT, is returned by the function, and the calling application can take 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.

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 DSN name if ODBC support is enabled.
TableList
Specifies the list of tables converted and copied to the desktop computer. It takes the following form:
tablename<period><period>[tablename<period><period>]

If this string 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, there is no need to delimit table names. Delimited table names are not supported.

Sync
Optional. Always False. Provided for future compatibility.
Overwrite
Optional. Setting this argument to True causes any tables with the same name in the desktop computer’s database to be overwritten. Setting this argument to False causes an error to be generated, if a table of the same name already exists. True is the default.
DeviceLocn
Provided for future compatibility. Always a zero-length string (““). Database tables are always copied from the H/PC object store.

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"