dotConnect for SQL Server Documentation
Devart.Data.SqlServer Namespace / SqlParameterCollection Class
Members Example

In This Topic
    SqlParameterCollection Class
    In This Topic
    Collects all parameters relevant to a SqlCommand as well as their respective mappings to System.Data.DataSet columns.
    Syntax
    Remarks
    The number of parameters in the collection must be equal to the number of parameter placeholders within the command text, or SQL Server raises an error.
    Example
    The following example adds instance of SqlParameter to collection.
    public void AddSqlParameters()
    {
      // Create myConnection and myCommand.
    
      myCommand.CommandText = "DELETE Test.Dept WHERE DeptNo = :DeptNo";
      myCommand.Parameters.Add("DeptNo", SqlType.Int).Value = 50;
      myCommand.ExecuteNonQuery();
    }
    Public Sub AddSqlParameters()
      // Create myConnection and myCommand.
    
      myCommand.CommandText = "DELETE Test.Dept WHERE DeptNo = :DeptNo"
      myCommand.Parameters.Add("DeptNo", SqlType.Int).Value = 50
      myCommand.ExecuteNonQuery()
    
    End Sub 'AddSqlParameters
    Inheritance Hierarchy

    System.Object
       System.MarshalByRefObject
          System.Data.Common.DbParameterCollection
             Devart.Common.DbParameterBaseCollection
                Devart.Data.SqlServer.SqlParameterCollection

    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