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)。若要利用 .NET Framework Data Provider for OLE DB 正常運作,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 時,.NET Framework Data Provider for SQL Server 會將 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.

備註

每當採取可能會變更 DataSet架構的動作時,就會使用 MissingSchemaAction 值。The MissingSchemaAction values are used whenever an action is taken that could change the schema of the DataSet.

適用於

另請參閱