Npgsql Api Docs |

# NpgsqlParameterCollection.Add Method (String, Object)

Adds a NpgsqlParameter to the NpgsqlParameterCollection given the specified parameter name and value.

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

#### Parameters

parameterName
  The name of the NpgsqlParameter.
value
  The Value of the NpgsqlParameter to add to the collection.

#### Return Value

The index of the new NpgsqlParameter object.

#### Remarks

Use caution when using this overload of the Add method to specify integer parameter values. Because this overload takes a value of type Object, you must convert the integral value to an Object type when the value is zero, as the following C# example demonstrates.

    parameters.Add(":pname", Convert.ToInt32(0));

If you do not perform this conversion, the compiler will assume you are attempting to call the NpgsqlParameterCollection.Add(string, DbType) overload.

#### See Also

NpgsqlParameterCollection Class | Npgsql Namespace | NpgsqlParameterCollection.Add Overload List