SqlCeRemoteDataAccess Class

Initializes a new instance of the SqlCeRemoteDataAccess object. For more information about Remote Data Access, see the SQL Server Compact Edition Books Online.

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

public sealed class SqlCeRemoteDataAccess : IDisposable
public final class SqlCeRemoteDataAccess implements IDisposable
public final class SqlCeRemoteDataAccess implements IDisposable
Not applicable.

SQL Server Compact Edition is not currently optimized to serve as a database for Web sites. By default, connections from ASP.NET-connected applications are blocked in SQL Server Compact Edition. SQL Server Compact Edition is optimized for use as an embedded database within applications. Using SQL Server Compact Edition as a database for Web sites requires support for multiple users and concurrent data changes. This can cause performance problems. Therefore, these scenarios are not supported. Other editions of SQL Server 2005, including SQL Server 2005 Express Edition, are optimized to serve as a database for Web sites.

SQL Server Compact Edition can be used with ASP.NET in application scenarios where ASP.NET is used to create SQL Server Compact Edition databases for synchronization scenarios. Use the following code to change the default behavior of Compact Edition to work within ASP.NET.

AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true)

The following example shows how to initialize a new instance of the SqlCeRemoteDataAccess object.

// 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 the Pull Operation
    rda = new SqlCeRemoteDataAccess(
        "Data Source=MyDatabase.sdf");

    rda.Pull("Employees", "SELECT * FROM DimEmployee", rdaOleDbConnectString,
        RdaTrackOption.TrackingOnWithIndexes, "ErrorTable");

    // or, try one of these overloads:
    // rda.Pull("Employees", "SELECT * FROM DimEmployee", rdaOleDbConnectString,
    //     RdaTrackOption.TrackingOnWithIndexes);
    // rda.Pull("Employees", "SELECT * FROM DimEmployee", rdaOleDbConnectString);
catch (SqlCeException)
    // Handle errors here
    // Dispose of the RDA object


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

.NET Compact Framework

Supported in: 2.0, 1.0