An NDoc Documented Class Library |

# NpgsqlParameter Constructor (String, Object)

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

[Visual Basic]
Overloads Public Sub New( _
ByVal parameterName As String, _
ByVal value As Object _
)
[C#]
public NpgsqlParameter(
string parameterName,
object value
);

#### Parameters

parameterName
  The name of the parameter to map.
value
  An Object that is the value of the NpgsqlParameter.

#### Remarks

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.

#### See Also

NpgsqlParameter Class | Npgsql Namespace | NpgsqlParameter Constructor Overload List