Freigeben über


SqlCeReplication.DropSubscription-Methode

Hinweis: Dieser Namespace oder Member bzw. diese Klasse wird nur von .NET Framework, Version 1.1, unterstützt.

Löscht das Abonnement der SQL Server-Veröffentlichung und löscht optional die SQL Server CE-Datenbank vom Windows CE .NET-Gerät.

Public Sub DropSubscription( _
   ByVal dropOption As DropOption _)
[C#]
public void DropSubscription(DropOptiondropOption);
[C++]
public: void DropSubscription(DropOptiondropOption);
[JScript]
public function DropSubscription(
   dropOption : DropOption);

Parameter

  • dropOption

Hinweise

Der DropOption-Wert gibt an, ob die SQL Server CE-Datenbank beibehalten oder gelöscht werden soll, und kann eine der folgenden Konstanten sein:

Element Beschreibung
DropDatabase Löscht die SQL Server CE-Datenbank (Standardeinstellung).
LeaveDatabase Löscht die Replikationssystemtabellen und drei Replikationssystemspalten in den Benutzertabellen, doch die Datenbank wird nicht gelöscht.

Beispiel

 
Dim repl As SqlCeReplication = Nothing

Try
   ' Set the Replication object
   repl = New SqlCeReplication()
   repl.SubscriberConnectionString = "Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\ssce.sdf"
   
   ' Drop the subscription and delete the database.
   repl.DropSubscription(DropOption.DropDatabase)

Catch e As SqlCeException
' Use your own error handling routine to show error information.
' ShowError.ShowErrors(e);

Finally
   ' Dispose of the Replication Object
   repl.Dispose()
End Try

[C#] 

        SqlCeReplication repl = null;

        try {
            // Set the Replication object
            repl = new SqlCeReplication();
            repl.SubscriberConnectionString = "Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\\ssce.sdf";

            // Drop the subscription and delete the database.
            repl.DropSubscription(DropOption.DropDatabase);
        }
   
        catch(SqlCeException) {
            // Use your own error handling routine to show error information.
        }

        finally {
            // Dispose of the Replication Object
            repl.Dispose();
        }

[C++, JScript] Für C++ oder JScript ist kein Beispiel verfügbar. Klicken Sie zum Anzeigen eines Beispiels für Visual Basic oder C# in der linken oberen Ecke der Seite auf die Schaltfläche "Sprachfilter" Sprachfilter.

Anforderungen

Plattformen: .NET Compact Framework - Windows CE .NET

.NET Framework-Sicherheit:

Siehe auch

SqlCeReplication-Klasse | SqlCeReplication-Member | System.Data.SqlServerCe-Namespace