Condividi tramite


SqlParameter.IsNullable Proprietà

Definizione

Ottiene o imposta un valore che indica se il parametro ammette valori Null. IsNullable non viene usata per convalidare il valore del parametro e non impedisce l'invio o la ricezione di un valore Null quando si esegue un comando.

public:
 virtual property bool IsNullable { bool get(); void set(bool value); };
public override bool IsNullable { get; set; }
member this.IsNullable : bool with get, set
Public Overrides Property IsNullable As Boolean

Valore della proprietà

true se sono ammessi valori Null; in caso contrario, false. Il valore predefinito è false.

Esempio

Nell'esempio seguente viene creato un oggetto SqlParameter e vengono impostate alcune delle relative proprietà.

// using Microsoft.Data.SqlClient;
static void CreateSqlParameterNullable()
{
    SqlParameter parameter = new SqlParameter("Description", SqlDbType.VarChar, 88);
    parameter.IsNullable = true;
    parameter.Direction = ParameterDirection.Output;
}

Commenti

I valori Null vengono gestiti usando la DBNull classe .

Si applica a