Npgsql.NpgsqlParameter.NpgsqlParameter.NpgsqlParameter C# (CSharp) Method

NpgsqlParameter() public method

Initializes a new instance of the NpgsqlParameter class with the parameter name and a value of the new NpgsqlParameter.

When you specify an Object in the value parameter, the DbType is inferred from the .NET Framework type of the Object.

When using this constructor, you must be aware of a possible misuse of the constructor which takes a DbType parameter. This happens when calling this constructor passing an int 0 and the compiler thinks you are passing a value of DbType. Use Convert.ToInt32(value) for example to have compiler calling the correct constructor.

public NpgsqlParameter ( String parameterName, object value ) : System
parameterName String The name of the parameter to map.
value object An Object that is the value of the NpgsqlParameter.
return System
        public NpgsqlParameter(String parameterName, object value) : this()
        {
            ParameterName = parameterName;
            Value = value;
        }

Same methods

NpgsqlParameter.NpgsqlParameter::NpgsqlParameter ( ) : System
NpgsqlParameter.NpgsqlParameter::NpgsqlParameter ( string parameterName, DbType parameterType ) : System
NpgsqlParameter.NpgsqlParameter::NpgsqlParameter ( string parameterName, DbType parameterType, int size ) : System
NpgsqlParameter.NpgsqlParameter::NpgsqlParameter ( string parameterName, DbType parameterType, int size, string sourceColumn ) : System
NpgsqlParameter.NpgsqlParameter::NpgsqlParameter ( string parameterName, DbType parameterType, int size, string sourceColumn, ParameterDirection direction, bool isNullable, byte precision, byte scale, DataRowVersion sourceVersion, object value ) : System
NpgsqlParameter.NpgsqlParameter::NpgsqlParameter ( string parameterName, NpgsqlDbType parameterType ) : System
NpgsqlParameter.NpgsqlParameter::NpgsqlParameter ( string parameterName, NpgsqlDbType parameterType, int size ) : System
NpgsqlParameter.NpgsqlParameter::NpgsqlParameter ( string parameterName, NpgsqlDbType parameterType, int size, string sourceColumn ) : System
NpgsqlParameter.NpgsqlParameter::NpgsqlParameter ( string parameterName, NpgsqlDbType parameterType, int size, string sourceColumn, ParameterDirection direction, bool isNullable, byte precision, byte scale, DataRowVersion sourceVersion, object value ) : System