다음을 통해 공유


SqlCeRemoteDataAccess 클래스

SqlCeRemoteDataAccess 개체의 새 인스턴스를 초기화합니다. RDA(Remote Data Access)에 대한 자세한 내용은 RDA(Remote Data Access) 사용을 참조하십시오.

네임스페이스:  System.Data.SqlServerCe
어셈블리:  System.Data.SqlServerCe.dll의 System.Data.SqlServerCe

구문

‘선언
Public NotInheritable Class SqlCeRemoteDataAccess _
    Implements IDisposable
‘사용 방법
Dim instance As SqlCeRemoteDataAccess
public sealed class SqlCeRemoteDataAccess : IDisposable
public ref class SqlCeRemoteDataAccess sealed : IDisposable
[<SealedAttribute>]
type SqlCeRemoteDataAccess =  
    class
        interface IDisposable
    end
public final class SqlCeRemoteDataAccess implements IDisposable

주의

SQL Server Compact 3.5은 현재 웹 사이트용 데이터베이스로 최적화되어 있지 않습니다. 기본적으로 ASP.NET에 연결된 응용 프로그램으로부터의 연결은 SQL Server Compact 3.5에서 차단됩니다. SQL Server Compact 3.5은 응용 프로그램 내에서 포함된 데이터베이스로 사용하도록 최적화되어 있습니다. SQL Server Compact 3.5을 웹 사이트용 데이터베이스로 사용하려면 여러 사용자 및 동시 데이터 변경을 지원해야 하는데 이 경우 성능 문제가 발생할 수 있습니다. 따라서 이러한 시나리오는 지원되지 않습니다. SQL Server 2005 Express Edition 이상 버전을 비롯한 SQL Server의 다른 버전은 웹 사이트용 데이터베이스로 사용하도록 최적화되어 있습니다.

SQL Server Compact 3.5은 ASP.NET을 사용하여 동기화 시나리오에 사용할 SQL Server Compact 3.5 데이터베이스를 만드는 응용 프로그램 시나리오에서는 ASP.NET과 함께 사용할 수 있습니다. ASP.NET 내에서 작동하는 SQL Server Compact 3.5의 기본 동작을 변경하려면 다음 코드를 사용합니다.

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

예제

다음 예제에서는 SqlCeRemoteDataAccess 개체의 새 인스턴스를 초기화하는 방법을 보여 줍니다.

' 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 Pull Operation
    '
    rda = New SqlCeRemoteDataAccess( _
        "https://www.adventure-works.com/sqlmobile/sqlcesa35.dll", _
        "MyLogin", _
        "<password>", _
        "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
    ' 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 Pull Operation
    //
    rda = new SqlCeRemoteDataAccess(
        "https://www.adventure-works.com/sqlmobile/sqlcesa35.dll",
        "MyLogin",
        "<password>",
        "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
    //
}
finally
{
    // Dispose of the RDA object
    //
    rda.Dispose();
}

상속 계층 구조

System. . :: . .Object
  System.Data.SqlServerCe..::..SqlCeRemoteDataAccess

스레드로부터의 안전성

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

참고 항목

참조

SqlCeRemoteDataAccess 멤버

System.Data.SqlServerCe 네임스페이스