DataAdapter.MissingSchemaAction 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
确定现有 DataSet 架构与传入数据不匹配时需要执行的操作。
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