SqlCeReplication.DropSubscription Method

Interrompe la sottoscrizione a una pubblicazione di SQL Server ed elimina il database di SQL Server Compact 3.5 dal dispositivo Windows Mobile. Quest'ultima operazione è facoltativa.

Spazio dei nomi: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in system.data.sqlserverce.dll)

Sintassi

'Dichiarazione
Public Sub DropSubscription ( _
    dropOption As DropOption _
)
public void DropSubscription (
    DropOption dropOption
)
public:
void DropSubscription (
    DropOption dropOption
)
public void DropSubscription (
    DropOption dropOption
)
public function DropSubscription (
    dropOption : DropOption
)

Parametri

  • dropOption

Osservazioni

Il valore dell'enumerazione DropOption specifica se mantenere o eliminare il database di SQL Server Compact 3.5. Il valore può essere una delle seguenti costanti:

Elemento

Descrizione

DropDatabase

Consente di eliminare il database di SQL Server Compact 3.5 (valore predefinito).

LeaveDatabase

Consente di eliminare le tabelle del sistema di replica e tre colonne di replica nelle tabelle utente del sistema stesso, ma non di eliminare il database.

Esempio

Nell'esempio seguente viene illustrato come rilasciare una sottoscrizione ed eliminare il database locale. Viene creato un oggetto SqlCeReplication, viene impostata la proprietà SubscriberConnectionString e quindi viene chiamato il metodo DropSubscription. Con questo metodo viene passata l'opzione DropDatabase.

Dim repl As SqlCeReplication = Nothing

Try
    ' Create SqlCeReplication instance
    '
    repl = New SqlCeReplication()
    repl.SubscriberConnectionString = "Data Source=MyDatabase.sdf"

    ' Drop the subscription and delete the database
    '
    repl.DropSubscription(DropOption.DropDatabase)
Catch
    ' Handle errors here
Finally
    ' Dispose the repl object
    '
    repl.Dispose()
End Try
SqlCeReplication repl = null;

try
{
    // Create SqlCeReplication instance
    //
    repl = new SqlCeReplication();
    repl.SubscriberConnectionString = "Data Source=MyDatabase.sdf";

    // Drop the subscription and delete the database
    //
    repl.DropSubscription(DropOption.DropDatabase);
}
catch (SqlCeException)
{
    // Handle errors here
}
finally
{
    // Dispose the repl object
    //
    repl.Dispose();
}

Affidabilità

Tutti i membri statici pubblici (Shared in Microsoft Visual Basic) di questo tipo sono affidabili. Non è invece garantita l'affidabilità dei membri dell'istanza.

Piattaforme

Piattaforme di sviluppo

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
Informazioni sulla versione
.NET Framework e .NET Compact Framework
Supportato in 3.5
.NET Framework
Supportato in 3.0
.NET Compact Framework e .NET Framework
Supportato in 2.0

Vedere anche

Riferimento

SqlCeReplication Class
SqlCeReplication Members
System.Data.SqlServerCe Namespace