dotConnect for MySQL Documentation
Devart.Data.MySql Namespace / MySqlParameterCollection Class / Add Method / Add(String,MySqlType,Int32) Method
The name of the parameter.
One of the MySqlType values.
The maximum size, in bytes, of the data the parameter can contain.
Example

In This Topic
    Add(String,MySqlType,Int32) Method
    In This Topic
    Adds a MySqlParameter to the MySqlParameterCollection given the the parameter name, data type, and data size.
    Syntax
    'Declaration
     
    Public Overloads Function Add( _
       ByVal parameterName As String, _
       ByVal dbType As MySqlType, _
       ByVal size As Integer _
    ) As MySqlParameter
    public MySqlParameter Add( 
       string parameterName,
       MySqlType dbType,
       int size
    )

    Parameters

    parameterName
    The name of the parameter.
    dbType
    One of the MySqlType values.
    size
    The maximum size, in bytes, of the data the parameter can contain.

    Return Value

    The new MySqlParameter object.
    Example
    The following example creates a MySqlParameterCollection, adds instances of MySqlParameter to the collection, and returns a reference to the new MySqlParameter.
    public void CreateMySqlParamColl(MySqlConnection myConn) {
      MySqlCommand myCommand = new MySqlCommand("SELECT * FROM Test.Dept WHERE DeptNo = :DeptNo", myConn);
      MySqlParameterCollection myParamCollection = myCommand.Parameters;
      MySqlParameter myNewParameter = myParamCollection.Add("DeptNo", MySqlType.Int, 40);
    }
    Public Sub CreateMySqlParamColl(myConn As MySqlConnection)
      Dim myCommand As MySqlCommand = New MySqlCommand("SELECT * FROM Test.Dept WHERE DeptNo = :DeptNo", myConn)
      Dim myParamCollection As MySqlParameterCollection = myCommand.Parameters
      Dim myNewParameter As MySqlParameter = myParamCollection.Add("DeptNo", MySqlType.Int, 40)
    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