DataAdapter.MissingSchemaAction 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
判斷在現有 DataSet 結構描述 (Schema) 與傳入的資料不相符時要採取的動作。
public:
property System::Data::MissingSchemaAction MissingSchemaAction { System::Data::MissingSchemaAction get(); void set(System::Data::MissingSchemaAction value); };
public System.Data.MissingSchemaAction MissingSchemaAction { get; set; }
[System.Data.DataSysDescription("DataAdapter_MissingSchemaAction")]
public System.Data.MissingSchemaAction MissingSchemaAction { get; set; }
member this.MissingSchemaAction : System.Data.MissingSchemaAction with get, set
[<System.Data.DataSysDescription("DataAdapter_MissingSchemaAction")>]
member this.MissingSchemaAction : System.Data.MissingSchemaAction with get, set
Public Property MissingSchemaAction As MissingSchemaAction
屬性值
其中一個 MissingSchemaAction 值。 預設為 Add
。
實作
- 屬性
例外狀況
設定的值不是其中一個 MissingSchemaAction 值。
範例
下列範例會建立衍生類別, OleDbDataAdapter 並設定其部分屬性。
// Assumes a valid connection string to an Access database.
static void CreateOleDbAdapter(string connectionString)
{
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.SelectCommand =
new OleDbCommand("SELECT * FROM Categories ORDER BY CategoryID");
adapter.SelectCommand.Connection =
new OleDbConnection(connectionString);
adapter.MissingMappingAction = MissingMappingAction.Error;
adapter.MissingSchemaAction = MissingSchemaAction.Error;
}
' Assumes a valid connection string to an Access database.
Private Sub CreateOleDbDataAdapter(ByVal connectionString As String)
Dim adapter As New OleDbDataAdapter()
adapter.SelectCommand = _
New OleDbCommand("SELECT * FROM Categories ORDER BY CategoryID")
adapter.SelectCommand.Connection = New OleDbConnection _
(connectionString)
adapter.MissingMappingAction = MissingMappingAction.Error
adapter.MissingSchemaAction = MissingSchemaAction.Error
End Sub
適用於
另請參閱
- MissingMappingAction
- ADO.NET 概觀 \(部分機器翻譯\)