dotConnect for MySQL Documentation
Devart.Data.MySql Namespace / MySqlParameterCollection Class / Add Method / Add(String,MySqlType,Int32) Method
The name of the parameter.
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
    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
    See Also