Downloads data from a remote Microsoft SQL Server database and stores that data in a single table in a local Microsoft SQL Server Compact 3.5 database.

Before calling the Pull method, you must set the following RDA object properties:

  • The InternetURL property must contain the URL of the SQL Server Compact 3.5 Server Agent.

  • The LocalConnectionString property must contain the OLE DB connection string for the SQL Server Compact 3.5 database on the device.

  • The InternetLogin and InternetPassword properties must be specified if the SQL Server Compact 3.5 Server Agent is configured to use Basic or Integrated Authentication.

object.Pull (localTableName, sqlSelectString, oledbConnectionString,  RDA_TRACKOPTION, ErrorTableName)

Applies To

SQL Server Compact 3.5 RemoteDataAccess object

  • LocalTableName
    The name of the SQL Server Compact 3.5 table that receives the extracted SQL Server records. An error occurs if the table already exists.

  • SQLSelectString
    A string that specifies which table, columns, and records to extract from the SQL Server database and store in the SQL Server Compact 3.5 database. This string can be any valid SQL statement that returns rows, including SELECT statements or stored procedures.

  • OLEDBConnectionString
    An OLE DB connection string used when connecting to the SQL Server database.

  • RDA_TRACKOPTION
    The RDA_TRACKOPTION enumeration indicates whether to track changes made to the pulled table. When indexes are requested, indexes that exist on the table being pulled are brought down to the device with the PRIMARY KEY constraints. For more information, see RDA_TRACKOPTION.

  • ErrorTableName
    The name of the local error table that is created if an error occurs when the Push method is later called to send changes back to SQL Server. This option can be specified only when RDA_TRACKOPTION is set to TRACKINGON.

SQLSelectString

The SQLSelectString parameter controls which data is pulled from the SQL Server table. Consider the following when you use the SQLSelectString parameter:

  • The SQLSelectString parameter can specify a WHERE clause to control which records are returned. For example, SELECT * FROM Address WHERE PostalCode='93868' retrieves addresses for the specified postal code only.

  • SQLSelectString supports stored procedures and views that return rows.

  • SQLSelectString can pull selected columns from multiple tables into a single table, but only if the RDA_TRACKOPTION parameter is set to TRACKINGOFF.

  • An error occurs if the resulting recordset contains an unsupported data type, such as timestamp.

ErrorTableName

The ErrorTableName parameter specifies the name of the table in which errors that occur during a push will be stored. If an error occurs when the application calls the Push method, SQL Server Compact 3.5 creates the error table and adds a record to the table for each error that occurs. When the Push method finishes, the application can examine the error table to determine whether errors have occurred. ErrorTableName can be specified only when either TRACKINGON or TRACKINGONWITHINDEXES is specified. For more information about how the error table works, see RDA Conflict Detection and Reporting.

Reference

RDA Object Methods

Push Method (RDA)