DataSourceView.CanInsert 속성

정의

현재 DataSourceView 개체와 연결된 DataSourceControl 개체가 ExecuteInsert(IDictionary) 작업을 지원하는지 여부를 나타내는 값을 가져옵니다.

public:
 virtual property bool CanInsert { bool get(); };
public virtual bool CanInsert { get; }
member this.CanInsert : bool
Public Overridable ReadOnly Property CanInsert As Boolean

속성 값

Boolean

작업이 지원되면 true이고, 그렇지 않으면 false입니다. 기본 클래스 구현은 false를 반환합니다.

예제

다음 코드 예제에서는 재정의 하는 방법에 설명 합니다 CanInsert 속성 및 ExecuteInsert 확장 하는 클래스의 메서드는 DataSourceView 클래스. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 DataSourceView 클래스입니다.

// The CsvDataSourceView does not currently
// permit insertion of a new record. You can
// modify or extend this sample to do so.
public override bool CanInsert {
    get {
        return false;
    }
}
protected override int ExecuteInsert(IDictionary values)
{
    throw new NotSupportedException();
}
' The CsvDataSourceView does not currently
' permit insertion of a new record. You can
' modify or extend this sample to do so.
Public Overrides ReadOnly Property CanInsert() As Boolean
   Get
      Return False
   End Get
End Property

Protected Overrides Function ExecuteInsert(values As IDictionary) As Integer
   Throw New NotSupportedException()
End Function 'ExecuteInsert

설명

CanInsert 속성 반영 뿐만 아니라 데이터 소스 컨트롤의 기능 뿐만 아니라 현재 작업을 수행할 적절 한 것입니다. 데이터 소스 컨트롤을 지원 하더라도 예를 들어를 ExecuteInsert 작업을 필수 insert 명령 또는 일부 다른 데이터를 설정 하지 않으면 합니다 CanInsert 속성에서 반환 false삽입 작업은 실패, 합니다.

적용 대상

추가 정보