DataColumn.AllowDBNull Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém ou define um valor que indica se valores nulos são permitidos nesta coluna para linhas que pertencem à tabela.
public:
property bool AllowDBNull { bool get(); void set(bool value); };
[System.Data.DataSysDescription("DataColumnAllowNullDescr")]
public bool AllowDBNull { get; set; }
public bool AllowDBNull { get; set; }
[<System.Data.DataSysDescription("DataColumnAllowNullDescr")>]
member this.AllowDBNull : bool with get, set
member this.AllowDBNull : bool with get, set
Public Property AllowDBNull As Boolean
Valor de Propriedade
true se forem permitidos valores nulos; caso contrário, false. A predefinição é true.
- Atributos
Exemplos
O exemplo seguinte cria um novo DataColumn e define a sua AllowDBNull propriedade para 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