dotConnect for PostgreSQL Documentation
Devart.Data.PostgreSql Namespace / PgSqlParameterCollection Class / Add Method / Add(String,PgSqlType,Int32,String) Method
The name of the parameter.
One of the PgSqlType values.
The maximum size, in bytes, of the data the parameter can contain.
The name of the source column.
Example

In This Topic
    Add(String,PgSqlType,Int32,String) Method
    In This Topic
    Adds a PgSqlParameter to the PgSqlParameterCollection given the parameter name, data type, column width, and source column name.
    Syntax
    'Declaration
     
    Public Overloads Function Add( _
       ByVal parameterName As String, _
       ByVal dbType As PgSqlType, _
       ByVal size As Integer, _
       ByVal sourceColumn As String _
    ) As PgSqlParameter
    public PgSqlParameter Add( 
       string parameterName,
       PgSqlType dbType,
       int size,
       string sourceColumn
    )

    Parameters

    parameterName
    The name of the parameter.
    dbType
    One of the PgSqlType values.
    size
    The maximum size, in bytes, of the data the parameter can contain.
    sourceColumn
    The name of the source column.

    Return Value

    The new PgSqlParameter object.
    Example
    The following example creates a PgSqlParameterCollection, adds instances of PgSqlParameter to the collection, and returns a reference to the new PgSqlParameter.
    public void CreatePgSqlParamColl(PgSqlConnection myConn) {
      PgSqlCommand pgCommand = new PgSqlCommand("SELECT * FROM Test.Dept WHERE DeptNo = :DeptNo", myConn);
      PgSqlParameterCollection myParamCollection = pgCommand.Parameters;
      PgSqlParameter myNewParameter = myParamCollection.Add("DeptNo", PgSqlType.Int, 40, "DeptNo");
    }
    Public Sub CreatePgSqlParamColl(myConn As PgSqlConnection)
      Dim pgCommand As PgSqlCommand = New PgSqlCommand("SELECT * FROM Test.Dept WHERE DeptNo = :DeptNo", myConn)
      Dim myParamCollection As PgSqlParameterCollection = pgCommand.Parameters
      Dim myNewParameter As PgSqlParameter = myParamCollection.Add("DeptNo", PgSqlType.Int, 40, "DeptNo")
    End Sub
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also