SqlCeConnection.FlushFailure Event
Si verifica quando lo svuotamento in background ha esito negativo.
Spazio dei nomi: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in system.data.sqlserverce.dll)
Sintassi
'Dichiarazione
Public Event FlushFailure As SqlCeFlushFailureEventHandler
public event SqlCeFlushFailureEventHandler FlushFailure
public:
event SqlCeFlushFailureEventHandler^ FlushFailure {
void add (SqlCeFlushFailureEventHandler^ value);
void remove (SqlCeFlushFailureEventHandler^ value);
}
/** @event */
public void add_FlushFailure (SqlCeFlushFailureEventHandler value)
/** @event */
public void remove_FlushFailure (SqlCeFlushFailureEventHandler value)
JScript supporta l'utilizzo di eventi, ma non la dichiarazione di nuovi eventi.
Esempio
Nell'esempio seguente viene illustrato come utilizzare l'evento FlushFailure:
Public Sub Snippet4()
Dim conn As SqlCeConnection = Nothing
Try
conn = New SqlCeConnection("Data Source = MyDatabase.sdf; Password ='<pwd>'")
AddHandler conn.FlushFailure, AddressOf conn_FlushFailure
conn.Open()
'Flush failure occurs here
'OnFlushFailure will be called from the background thread.
Finally
conn.Close()
End Try
End Sub
Private Sub conn_FlushFailure(ByVal sender As System.Object, ByVal e As SqlCeFlushFailureEventArgs)
Dim errors As SqlCeErrorCollection = e.Errors
Console.WriteLine("Flush Failure: " + errors(0).Message)
End Sub
// using System;
// using System.Xml;
// using System.Data;
// using System.Data.SqlServerCe;
// using System.Data.Common;
// using System.Windows.Forms;
/// <summary>
/// Demonstrates the usage of the FlushFailure event
/// </summary>
public class MyForm : Form
{
public void Snippet4()
{
SqlCeConnection conn = new SqlCeConnection();
conn.FlushFailure+=new SqlCeFlushFailureEventHandler(conn_FlushFailure);
conn.Open();
//Flush failure occurs here
//OnFlushFailure will be called from the background thread.
conn.Close();
}
void conn_FlushFailure(object sender, SqlCeFlushFailureEventArgs e)
{
SqlCeErrorCollection errors = e.Errors;
Console.WriteLine("Flush Failure:" + errors[0].Message);
}
}
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
SqlCeConnection Class
SqlCeConnection Members
System.Data.SqlServerCe Namespace