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.
Public Sub DropSubscription( _
ByVal dropOption As DropOption _)
[C#]
public void DropSubscription(DropOptiondropOption);
[C++]
public: void DropSubscription(DropOptiondropOption);
[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
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 in the upper-left corner of the page.
Requirements
Platforms: .NET Compact Framework
.NET Framework Security:
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries From Partially Trusted Code
See Also
SqlCeReplication Class | SqlCeReplication Members | System.Data.SqlServerCe Namespace