DataSourceView.CanInsert Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan nilai yang menunjukkan apakah objek yang DataSourceView terkait dengan objek saat ini DataSourceControl mendukung ExecuteInsert(IDictionary) operasi.
public:
virtual property bool CanInsert { bool get(); };
public virtual bool CanInsert { get; }
member this.CanInsert : bool
Public Overridable ReadOnly Property CanInsert As Boolean
Nilai Properti
true jika operasi didukung; jika tidak, false. Implementasi kelas dasar mengembalikan false.
Contoh
Contoh kode berikut menunjukkan cara mengambil alih CanInsert properti dan ExecuteInsert metode di kelas yang memperluas DataSourceView kelas. Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk DataSourceView kelas .
// 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
Keterangan
Properti CanInsert ini tidak hanya mencerminkan kemampuan kontrol sumber data, tetapi juga apakah saat ini sesuai untuk melakukan operasi. Misalnya, meskipun kontrol sumber data mendukung ExecuteInsert operasi, jika perintah sisipkan yang diperlukan atau beberapa data lain tidak diatur, CanInsert properti mengembalikan false, karena operasi penyisipan akan gagal.