Share via


SqlCeRemoteDataAccess.Push Method (String, String, RdaBatchOption)

Transmits changes from a pulled tracked table in SQL Server Mobile back to the SQL Server table. These changes can be either individually applied to the server or batched together in a single transaction.

Namespace: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in system.data.sqlserverce.dll)

Syntax

'Declaration
Public Sub Push ( _
    localTableName As String, _
    oleDBConnectionString As String, _
    batchOption As RdaBatchOption _
)
'Usage
Dim instance As SqlCeRemoteDataAccess
Dim localTableName As String
Dim oleDBConnectionString As String
Dim batchOption As RdaBatchOption

instance.Push(localTableName, oleDBConnectionString, batchOption)
public void Push (
    string localTableName,
    string oleDBConnectionString,
    RdaBatchOption batchOption
)
public:
void Push (
    String^ localTableName, 
    String^ oleDBConnectionString, 
    RdaBatchOption batchOption
)
public void Push (
    String localTableName, 
    String oleDBConnectionString, 
    RdaBatchOption batchOption
)
public function Push (
    localTableName : String, 
    oleDBConnectionString : String, 
    batchOption : RdaBatchOption
)

Parameters

  • localTableName
    The name of the SQL Server Mobile table that will receive the extracted SQL Server records. An error occurs if the table already exists.
  • oleDBConnectionString
  • batchOption
    The option indicates whether the changes being sent back to the SQL Server table should be batched together in a single transaction or individually applied.

Remarks

Applications call the Push method to transmit changes from a pulled tracked SQL Server Mobile table back to a SQL Server table. The application must have created the local SQL Server Mobile table by calling the Pull method with RdaTrackOption set to TrackingOn or TrackingOnWithIndexes.

oledbConnectionString specifies all the connection information used while connecting to SQL Server.

If SQL Server Authentication is used, the user ID specified in OLEDBConnectionString must have the authority to read the SQL Server table.

If Windows Authentication is used by setting INTEGRATED SECURITY="SSPI" in OLEDBConnectionString, the Internet user must have the authority to read the SQL Server table. The following identifies the Internet user based on the authentication method:

  • When Microsoft Internet Information Services (IIS) virtual directory is configured to use anonymous access, the Internet user runs under the identity of the Internet Guest Account (IUSR_computername). If you configure another Windows user account as the Internet Guest Account, the Internet user runs under the identity of that account.

  • When IIS virtual directory is configured to use Basic authentication, the Internet user runs under the identity of the Windows user account for which the client supplied the Internet user name and password.

  • When IIS virtual directory is configured to use Integrated Windows authentication, the Internet user runs under the identity of the Windows user account for which the client supplied the Internet user name and password.

If errorTableName was specified when the Pull method was called, any errors that are detected during the Push are logged in the error table. For more information about how the error table works, see "RDA Conflict Detection and Resolution" in SQL Server Mobile Books Online.

Example

The following example creates a SqlCeRemoteDataAccess object, sets several properties, and then calls the Push method.

' Connection String to the SQL Server
'
Dim rdaOleDbConnectString As String = "Data Source=MySqlServer;Initial Catalog=AdventureWorks; " & _
    "User Id=username;Password = <password>"

' Initialize RDA Object
'
Dim rda As SqlCeRemoteDataAccess = Nothing

Try
    ' Try the Push Operation
    '
    rda = New SqlCeRemoteDataAccess( _
        "https://www.adventure-works.com/sqlmobile/sqlcesa30.dll", _
        "Data Source=MyDatabase.sdf")

    rda.InternetLogin = "MyLogin"
    rda.InternetPassword = "<password>"

    rda.Push("MyLocalTable", rdaOleDbConnectString, RdaBatchOption.BatchingOn)

    ' or, try this overload:
    '
    ' rda.Push("MyLocalTable", rdaOleDbConnectString)

Catch
    ' Handle errors here
    '
Finally
    ' Dispose of the RDA Object
    '
    rda.Dispose()
End Try
// Connection String to the SQL Server
//
string rdaOleDbConnectString = "Data Source=MySqlServer;Initial Catalog=AdventureWorks; " +
    "User Id=username;Password = <password>";

// Initialize RDA Object
//
SqlCeRemoteDataAccess rda = null;

try
{
    // Try the Push Operation
    //
    rda = new SqlCeRemoteDataAccess(
        "https://www.adventure-works.com/sqlmobile/sqlcesa30.dll",
        "Data Source=MyDatabase.sdf");

    rda.InternetLogin = "MyLogin";
    rda.InternetPassword = "<password>";

    rda.Push("MyLocalTable", rdaOleDbConnectString, RdaBatchOption.BatchingOn);

    // or, try this overload:
    //
    // rda.Push("MyLocalTable", rdaOleDbConnectString);

catch (SqlCeException)
{
    // Handle errors here
    //

finally
{
    // Dispose of the RDA Object
    //
    rda.Dispose();

.NET Framework Security

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Platforms

Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows XP Professional x64 Edition, Windows XP SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Version Information

.NET Compact Framework

Supported in: 2.0, 1.0

See Also

Reference

SqlCeRemoteDataAccess Class
SqlCeRemoteDataAccess Members
System.Data.SqlServerCe Namespace