DataColumn.AllowDBNull 속성

정의

테이블에 속해 있는 행의 이 열에 null 값이 허용되는지 여부를 나타내는 값을 가져오거나 설정합니다.

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

속성 값

true null 값이 허용되면 이고, 그렇지 않으면 입니다 false. 기본값은 true입니다.

특성

예제

다음 예제에서는 새 DataColumn 를 만들고 해당 AllowDBNull 속성을 로 true설정합니다.

private void AddNullAllowedColumn()
{
    DataColumn column;
    column = new DataColumn("classID",
        System.Type.GetType("System.Int32"));
    column.AllowDBNull = true;

    // Add the column to a new DataTable.
    DataTable table;
    table = new DataTable();
    table.Columns.Add(column);
}
Private Sub AddNullAllowedColumn()
    Dim column As DataColumn
    column = New DataColumn("classID", _
        System.Type.GetType("System.Int32"))
    column.AllowDBNull = True

    ' Add the column to a new DataTable.
    Dim table As DataTable
    table = New DataTable
    table.Columns.Add(column)
End Sub

적용 대상

추가 정보