DataColumn.SetOrdinal(Int32) DataColumn.SetOrdinal(Int32) DataColumn.SetOrdinal(Int32) DataColumn.SetOrdinal(Int32) Method

定義

DataColumn 的序數或位置變更為指定的序數或位置。Changes the ordinal or position of the DataColumn to the specified ordinal or position.

public:
 void SetOrdinal(int ordinal);
public void SetOrdinal (int ordinal);
member this.SetOrdinal : int -> unit
Public Sub SetOrdinal (ordinal As Integer)

參數

ordinal
Int32 Int32 Int32 Int32

指定的序數。The specified ordinal.

備註

DataColumn 的序數或位置變更為指定的序數或位置。Changes the ordinal or position of the DataColumn to the specified ordinal or position. 如果序數小於0或大於現有的資料行數目-1 (大於最後一個資料行的序數),則會擲回無效ArgumentException的。If ordinal is less than 0 or greater than the existing number of columns - 1 (greater than the ordinal of the last column) then an Invalid ArgumentException is thrown.

當您變更資料行的序數時,會將資料行移至資料行集合中的新位置。When you change a column's ordinal, the column is moved to the new position in the collection of columns. 先前和新序數之間的任何資料行都會重新編號,以針對資料行的新序數進行調整。Any columns between the previous and new ordinal will be renumbered, to adjust for a column's new ordinal.

適用於

另請參閱