DataColumnMapping 類別

定義

含有繼承自 DataAdapter 之物件的泛用資料行對應。Contains a generic column mapping for an object that inherits from DataAdapter. 此類別無法獲得繼承。This class cannot be inherited.

public ref class DataColumnMapping sealed : MarshalByRefObject, ICloneable, System::Data::IColumnMapping
[System.ComponentModel.TypeConverter(typeof(System.Data.Common.DataColumnMapping/DataColumnMappingConverter))]
public sealed class DataColumnMapping : MarshalByRefObject, ICloneable, System.Data.IColumnMapping
public sealed class DataColumnMapping : MarshalByRefObject, ICloneable, System.Data.IColumnMapping
[System.ComponentModel.TypeConverter(typeof(System.Data.Common.DataColumnMappingConverter))]
public sealed class DataColumnMapping : MarshalByRefObject, ICloneable, System.Data.IColumnMapping
[<System.ComponentModel.TypeConverter(typeof(System.Data.Common.DataColumnMapping/DataColumnMappingConverter))>]
type DataColumnMapping = class
    inherit MarshalByRefObject
    interface IColumnMapping
    interface ICloneable
type DataColumnMapping = class
    inherit MarshalByRefObject
    interface IColumnMapping
    interface ICloneable
[<System.ComponentModel.TypeConverter(typeof(System.Data.Common.DataColumnMappingConverter))>]
type DataColumnMapping = class
    inherit MarshalByRefObject
    interface IColumnMapping
    interface ICloneable
Public NotInheritable Class DataColumnMapping
Inherits MarshalByRefObject
Implements ICloneable, IColumnMapping
繼承
DataColumnMapping
屬性
實作

範例

下列範例 DataColumnMapping 會建立物件,並將它加入至 DataColumnMappingCollectionThe following example creates a DataColumnMapping object and adds it to a DataColumnMappingCollection. 然後,它會告知使用者,對應已新增至集合,並顯示對應的父系。It then tells the user that the mapping was added to the collection and shows the Parent for the mapping.


public void AddDataColumnMapping() {
   // ...
   // create columnMappings
   // ...
   DataColumnMapping mapping =
      new DataColumnMapping("Description","DataDescription");
   columnMappings.Add((Object) mapping);
   Console.WriteLine("Column {0} added to column mapping collection {1}.",
       mapping.ToString(), columnMappings.ToString());
}
Public Sub AddDataColumnMapping()
    ' ...
    ' create columnMappings
    ' ...
    Dim mapping As New DataColumnMapping( _
       "Description", "DataDescription")
    columnMappings.Add(CType(mapping, Object))
    Console.WriteLine("Column {0} added to column mapping collection {1}.", _
       mapping.ToString(), columnMappings.ToString())
End Sub

備註

DataColumnMapping 讓您使用與資料來源中的資料行名稱不同的資料行名稱 DataTableA DataColumnMapping enables you to use column names in a DataTable that are different from those in the data source. DataAdapter當或資料來源中的資料表更新時,會使用對應來比對 DataSet 資料行。The DataAdapter uses the mapping to match the columns when the tables in the DataSet or data source are updated. 如需詳細資訊,請參閱 DataAdapter DataTable 和 DataColumn對應。For more information, see DataAdapter DataTable and DataColumn Mappings.

建構函式

DataColumnMapping()

初始化 DataColumnMapping 類別的新執行個體。Initializes a new instance of the DataColumnMapping class.

DataColumnMapping(String, String)

使用指定來源資料行名稱和要對應至的 DataColumnMapping 資料行名稱,來初始化 DataSet 類別的新執行個體。Initializes a new instance of the DataColumnMapping class with the specified source column name and DataSet column name to map to.

屬性

DataSetColumn

取得或設定在要對應的 DataSet 中的目的資料行名稱。Gets or sets the name of the column within the DataSet to map to.

SourceColumn

取得或設定在資料來源中的來源資料行名稱。Gets or sets the name of the column within the data source to map from. 名稱區分大小寫。The name is case-sensitive.

方法

CreateObjRef(Type)

建立包含所有相關資訊的物件,這些資訊是產生用來與遠端物件通訊的所需 Proxy。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(繼承來源 MarshalByRefObject)
Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetDataColumnBySchemaAction(DataTable, Type, MissingSchemaAction)

使用 DataColumnDataTable 屬性來從指定的 MissingSchemaAction 取得 DataSetColumnGets a DataColumn from the given DataTable using the MissingSchemaAction and the DataSetColumn property.

GetDataColumnBySchemaAction(String, String, DataTable, Type, MissingSchemaAction)

GetDataColumnBySchemaAction(DataTable, Type, MissingSchemaAction) 的靜態 (Static) 版本,無需對 DataColumnMapping 物件執行個體化即可對其進行呼叫。A static version of GetDataColumnBySchemaAction(DataTable, Type, MissingSchemaAction) that can be called without instantiating a DataColumnMapping object.

GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetLifetimeService()
已過時。

擷取控制這個執行個體存留期 (Lifetime) 原則的目前存留期服務物件。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(繼承來源 MarshalByRefObject)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
InitializeLifetimeService()
已過時。

取得存留期服務物件,以控制這個執行個體的存留期原則。Obtains a lifetime service object to control the lifetime policy for this instance.

(繼承來源 MarshalByRefObject)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
MemberwiseClone(Boolean)

建立目前 MarshalByRefObject 物件的淺層複本。Creates a shallow copy of the current MarshalByRefObject object.

(繼承來源 MarshalByRefObject)
ToString()

將目前的 SourceColumn 名稱轉換為字串。Converts the current SourceColumn name to a string.

明確介面實作

ICloneable.Clone()

建立目前執行個體複本的新物件。Creates a new object that is a copy of the current instance.

適用於

另請參閱