SqlCeReplication.DropSubscription Method

Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Drops the subscription to a SQL Server publication and optionally deletes the SQL Server CE database from the Windows CE .NET-based device.

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

Parameters

  • dropOption

Remarks

The DropOption value specifies whether to leave or delete the SQL Server CE database and can be one of these constants:

Item Description
DropDatabase Deletes the SQL Server CE database (default).
LeaveDatabase Deletes the replication system tables and three replication system columns in the user tables, but does not delete the database.

Example

  [Visual Basic] 
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] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: .NET Compact Framework

.NET Framework Security:

See Also

SqlCeReplication Class | SqlCeReplication Members | System.Data.SqlServerCe Namespace

Syntax based on .NET Framework version 1.1.
Documentation version 1.1.1.

Send comments on this topic.

© Microsoft Corporation. All rights reserved.