Partager via


SqlCeRemoteDataAccess Constructor (String, String)

Initialise une nouvelle instance de l'objet SqlCeRemoteDataAccess et la configure pour un accès anonyme aux services IIS (Internet Information Services) de Microsoft.

Espace de noms: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (dans system.data.sqlserverce.dll)

Syntaxe

'Déclaration
Public Sub New ( _
    internetUrl As String, _
    localConnectionString As String _
)
public SqlCeRemoteDataAccess (
    string internetUrl,
    string localConnectionString
)
public:
SqlCeRemoteDataAccess (
    String^ internetUrl, 
    String^ localConnectionString
)
public SqlCeRemoteDataAccess (
    String internetUrl, 
    String localConnectionString
)
public function SqlCeRemoteDataAccess (
    internetUrl : String, 
    localConnectionString : String
)

Paramètres

  • internetUrl
    URL utilisée pour se connecter à l'Agent serveur SQL Server Compact 3.5.
  • localConnectionString
    Chaîne de connexion OLE DB pour la base de données SQL Server Compact 3.5.

Remarques

Ce constructeur initialise les propriétés InternetUrl et LocalConnectionString. Les autres propriétés reçoivent leurs valeurs par défaut. Vous pouvez ensuite modifier la valeur de n'importe quelle propriété.

Exemple

' 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/sscesa35.dll>"
    rda.LocalConnectionString = "Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\ssce.sdf"
   
    rda.Pull("Employees", "Select * from Employees", _
       rdaOleDbConnectString, _
       RdaTrackOption.TrackingOnWithIndexes, _
       "ErrorTable")

Catch e As SqlCeException
'Use you own Error Handling Routine.
'ShowErrors(e);
Finally
   'Dispose of the RDA Object.
   rda.Dispose()
End Try
// 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/sscesa35.dll>";
    rda.LocalConnectionString  = @"Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\ssce.sdf";
   
    rda.Pull(
        "Employees", 
        "Select * from Employees", 
        rdaOleDbConnectString, 
        RdaTrackOption.TrackingOnWithIndexes , 
        "ErrorTable");
}
catch(SqlCeException) {
    //Use you own Error Handling Routine.
}
finally {
    //Dispose of the RDA Object.
    rda.Dispose();
}

Plateformes

Plateformes de développement

Windows Vista, Windows Mobile 5.0, Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Mobile 2003 for Pocket PC, Windows CE 5.0
Informations sur la version
.NET Framework et NET Compact Framework
Pris en charge dans 3.5
.NET Framework
Pris en charge dans 3.0
.NET Compact Framework et .Net Framework
Pris en charge dans 2.0

Voir aussi

Référence

SqlCeRemoteDataAccess Class
SqlCeRemoteDataAccess Members
System.Data.SqlServerCe Namespace