MissingSchemaAction 枚举

定义

指定在将数据添加到 DataSet 而缺少要求的 DataTableDataColumn 时要采取的操作。Specifies the action to take when adding data to the DataSet and the required DataTable or DataColumn is missing.

public enum class MissingSchemaAction
public enum MissingSchemaAction
type MissingSchemaAction = 
Public Enum MissingSchemaAction
继承
MissingSchemaAction

字段

Add 1

添加必需的列以完成架构。Adds the necessary columns to complete the schema.

AddWithKey 4

添加必需的列和主键信息以完成架构。Adds the necessary columns and primary key information to complete the schema. 有关如何将主键信息添加到 DataTable 的更多信息,请参见 FillSchema(DataSet, SchemaType)。为与用于 OLE DB 的 .NET Framework 数据提供程序一起正确运行,AddWithKey 要求本机 OLE DB 提供程序通过设置 DBPROP_UNIQUEROWS 属性获得必需的主键信息,然后通过检查 IColumnsRowset 中的 DBCOLUMN_KEYCOLUMN 确定哪些列是主键列。For more information about how primary key information is added to a DataTable, see FillSchema(DataSet, SchemaType).To function properly with the .NET Framework Data Provider for OLE DB, AddWithKey requires that the native OLE DB provider obtains necessary primary key information by setting the DBPROP_UNIQUEROWS property, and then determines which columns are primary key columns by examining DBCOLUMN_KEYCOLUMN in the IColumnsRowset. 作为一种备选方法,用户可以在每个 DataTable 上显式设置主键约束。As an alternative, the user may explicitly set the primary key constraints on each DataTable. 这将确保对与现有记录匹配的传入记录进行更新,而不是追加。This ensures that incoming records that match existing records are updated instead of appended. 当使用 AddWithKey 时,用于 SQL Server 的 .NET Framework 数据提供程序将 FOR BROWSE 子句追加到正在执行的语句。When using AddWithKey, the .NET Framework Data Provider for SQL Server appends a FOR BROWSE clause to the statement being executed. 用户应该注意潜在的副作用,例如对 SET FMTONLY ON 语句的使用产生的干扰。The user should be aware of potential side effects, such as interference with the use of SET FMTONLY ON statements. 有关详细信息,请参阅 SET FMTONLY (Transact-SQL)For more information, see SET FMTONLY (Transact-SQL).

Error 3

如果缺少指定的列映射,则生成 InvalidOperationExceptionAn InvalidOperationException is generated if the specified column mapping is missing.

Ignore 2

忽略额外列。Ignores the extra columns.

注解

MissingSchemaAction采取可能更改的架构DataSet的操作时, 将使用这些值。The MissingSchemaAction values are used whenever an action is taken that could change the schema of the DataSet.

适用于

另请参阅