dotConnect Universal Documentation
Devart.Data.Universal Namespace / UniParameterCollection Class / Add Method / Add(String,UniDbType) Method
The name of the parameter.
One of the UniDbType values.
Example

In This Topic
    Add(String,UniDbType) Method
    In This Topic
    Adds a UniParameter to the UniParameterCollection given the parameter name and data type.
    Syntax
    'Declaration
     
    Public Overloads Function Add( _
       ByVal parameterName As String, _
       ByVal type As UniDbType _
    ) As UniParameter
    public UniParameter Add( 
       string parameterName,
       UniDbType type
    )

    Parameters

    parameterName
    The name of the parameter.
    type
    One of the UniDbType values.

    Return Value

    The new UniParameter object.
    Example
    The following example creates a UniParameterCollection, adds instances of UniParameter to the collection, and returns a reference to the new UniParameter.
    public void CreateUniParamColl() {
      UniCommand myCommand = new UniCommand("SELECT * FROM Test.Dept WHERE DeptNo = :DeptNo", myConn);
      UniParameterCollection myParamCollection = myCommand.Parameters;
      object myParm = new UniParameter("DeptNo", UniDbType.Integer);
      int pIndex = myParamCollection.Add(myParm);
    }
    Public Sub CreateUniParamColl(myConn As UniConnection)
      Dim myCommand As UniCommand = New UniCommand("SELECT * FROM Test.Dept WHERE DeptNo = :DeptNo", myConn)
      Dim myParamCollection As UniParameterCollection = myCommand.Parameters
      Dim myParm As Object = New UniParameter("DeptNo", UniDbType.Integer)
      Dim pIndex As Integer = myParamCollection.Add(myParm)
    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