DataAdapter.MissingSchemaAction 属性

确定现有 DataSet 架构与传入数据不匹配时需要执行的操作。

**命名空间:**System.Data.Common
**程序集:**System.Data(在 system.data.dll 中)

语法

声明
Public Property MissingSchemaAction As MissingSchemaAction
用法
Dim instance As DataAdapter
Dim value As MissingSchemaAction

value = instance.MissingSchemaAction

instance.MissingSchemaAction = value
public MissingSchemaAction MissingSchemaAction { get; set; }
public:
virtual property MissingSchemaAction MissingSchemaAction {
    MissingSchemaAction get () sealed;
    void set (MissingSchemaAction value) sealed;
}
/** @property */
public final MissingSchemaAction get_MissingSchemaAction ()

/** @property */
public final void set_MissingSchemaAction (MissingSchemaAction value)
public final function get MissingSchemaAction () : MissingSchemaAction

public final function set MissingSchemaAction (value : MissingSchemaAction)

属性值

MissingSchemaAction 值之一。默认为 Add

异常

异常类型 条件

ArgumentException

设置的值不是 MissingSchemaAction 值之一。

示例

下面的示例创建一个派生类 OleDbDataAdapter 并设置它的一些属性。

' 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
// 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;
}

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

DataAdapter 类
DataAdapter 成员
System.Data.Common 命名空间
DataAdapter.MissingMappingAction 属性