DataColumn.ReadOnly DataColumn.ReadOnly DataColumn.ReadOnly DataColumn.ReadOnly Property

정의

테이블에 행을 추가한 후 열을 변경할 수 있는지 여부를 나타내는 값을 가져오거나 설정합니다.Gets or sets a value that indicates whether the column allows for changes as soon as a row has been added to the table.

public:
 property bool ReadOnly { bool get(); void set(bool value); };
[System.Data.DataSysDescription("DataColumnReadOnlyDescr")]
public bool ReadOnly { get; set; }
member this.ReadOnly : bool with get, set
Public Property ReadOnly As Boolean

속성 값

열이 읽기 전용이면 true이고, 그렇지 않으면 false입니다.true if the column is read only; otherwise, false. 기본값은 false입니다.The default is false.

예외

속성이 계산 열에서 false로 설정된 경우The property is set to false on a computed column.

예제

다음 예제는 DataColumn 설정 및 해당 ReadOnly 속성 true합니다.The following example creates a DataColumn and sets its ReadOnly property true.

private void AddColumn(DataTable table)
{
    // Add a DataColumn to the collection and set its properties.
    // The constructor sets the ColumnName of the column.
    DataColumn column = table.Columns.Add("Total");
    column.DataType = System.Type.GetType("System.Decimal");
    column.ReadOnly = true;
    column.Expression = "UnitPrice * Quantity";
    column.Unique = false;
}
Private Sub AddColumn(ByVal table As DataTable)
    ' Add a DataColumn to the collection and set its properties.
    ' The constructor sets the ColumnName of the column.
    Dim column As DataColumn = table.Columns.Add("Total")
    column.DataType = System.Type.GetType("System.Decimal")
    column.ReadOnly = True
    column.Expression = "UnitPrice * Quantity"
    column.Unique = False
End Sub

적용 대상

추가 정보