SqlCeRemoteDataAccess.Push Method (String, String, RdaBatchOption)
Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.
Transmits changes from a pulled tracked table in SQL Server CE back to the SQL Server table. These changes can be either individually applied to the server or batched together in a single transaction.
Overloads Public Sub Push( _
ByVal localTableName As String, _ ByVal oledbConnectionString As String, _ ByVal batchOption As RdaBatchOption _)
[C#]
public void Push(stringlocalTableName,stringoledbConnectionString,RdaBatchOptionbatchOption);
[C++]
public: void Push(String* localTableName,String* oledbConnectionString,RdaBatchOptionbatchOption);
[JScript]
public function Push(
localTableName : String,oledbConnectionString : String,batchOption : RdaBatchOption);
Parameters
- localTableName
The name of the SQL Server CE table that will receive the extracted SQL Server records. An error occurs if the table already exists. - oledbConnectionString
The OLE DB connection string used when connecting to the SQL Server database. - 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 CE table back to a SQL Server table. The application must have created the local SQL Server CE table by calling the Pull method with RdaTrackOption set to TrackingOn or TrackingOnWithIndexes.
oledbConnectionString specifies all the connect 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 CE Books Online.
Example
' Connection String to the SQL Server.
Dim rdaOleDbConnectString As String = _
"Provider=sqloledb; Data Source=MySqlServer;Initial Catalog=Northwind; " + "User Id=username;Password = <password>"
' Initialize RDA Object.
Dim rda As SqlCeRemoteDataAccess = Nothing
Try
'Try the Pull Operation.
rda = New SqlCeRemoteDataAccess()
rda.InternetLogin = "MyLogin"
rda.InternetPassword = "<password>"
rda.InternetUrl = "<http://www.northwindtraders.com/sqlce/sscesa20.dll>"
rda.LocalConnectionString = "Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\ssce.sdf"
rda.Push("MyLocalTable", rdaOleDbConnectString, RdaBatchOption.BatchingOn)
Catch e As SqlCeException
'Use you own Error Handling Routine.
'ShowErrors(e);
Finally
'Dispose of the RDA Object.
rda.Dispose()
End Try
[C#]
// Connection String to the SQL Server.
string rdaOleDbConnectString = "Provider=sqloledb; Data Source=MySqlServer;Initial Catalog=Northwind; " +
"User Id=username;Password = <password>";
// Initialize RDA Object.
SqlCeRemoteDataAccess rda = null;
try {
//Try the Pull Operation.
rda = new SqlCeRemoteDataAccess();
rda.InternetLogin = "MyLogin";
rda.InternetPassword = "<password>";
rda.InternetUrl = "<http://www.northwindtraders.com/sqlce/sscesa20.dll>";
rda.LocalConnectionString = @"Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\ssce.sdf";
rda.Push("MyLocalTable",
rdaOleDbConnectString,
RdaBatchOption.BatchingOn);
}
catch(SqlCeException) {
//Use you own Error Handling Routine.
}
finally {
//Dispose of the RDA Object.
rda.Dispose();
}
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button in the upper-left corner of the page.
Requirements
Platforms: .NET Compact Framework
.NET Framework Security:
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries From Partially Trusted Code
See Also
SqlCeRemoteDataAccess Class | SqlCeRemoteDataAccess Members | System.Data.SqlServerCe Namespace | SqlCeRemoteDataAccess.Push Overload List