DataAdapter.MissingMappingAction 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
判斷在傳入的資料不具有相符的資料表或資料行時要採取的動作。
public:
property System::Data::MissingMappingAction MissingMappingAction { System::Data::MissingMappingAction get(); void set(System::Data::MissingMappingAction value); };
public System.Data.MissingMappingAction MissingMappingAction { get; set; }
[System.Data.DataSysDescription("DataAdapter_MissingMappingAction")]
public System.Data.MissingMappingAction MissingMappingAction { get; set; }
member this.MissingMappingAction : System.Data.MissingMappingAction with get, set
[<System.Data.DataSysDescription("DataAdapter_MissingMappingAction")>]
member this.MissingMappingAction : System.Data.MissingMappingAction with get, set
Public Property MissingMappingAction As MissingMappingAction
屬性值
其中一個 MissingMappingAction 值。 預設值為 Passthrough
。
實作
- 屬性
例外狀況
設定的值不是其中一個 MissingMappingAction 值。
範例
下列範例會建立衍生類別, 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
備註
屬性 TableMappings 提供傳回記錄與 DataSet之間的主要對應。
適用於
另請參閱
- MissingSchemaAction
- ADO.NET 概觀 \(部分機器翻譯\)