Share via


SqlCeConnection.FlushFailure Event

백그라운드 플러시가 실패하면 발생합니다.

네임스페이스: System.Data.SqlServerCe
어셈블리: System.Data.SqlServerCe(system.data.sqlserverce.dll에 있음)

구문

‘선언
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는 이벤트 사용을 지원하지만 새로운 이벤트 선언은 지원하지 않습니다.

다음 예제에서는 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);
    }
}

플랫폼

개발 플랫폼

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
버전 정보
.NET Framework 및 NET Compact Framework
3.5에서 지원됨
.NET Framework
3.0에서 지원됨
.NET Compact Framework 및 .Net Framework
2.0에서 지원됨

참고 항목

참조

SqlCeConnection Class
SqlCeConnection Members
System.Data.SqlServerCe Namespace