Send feedback on this topic.
Teradata.Client.Provider
TdParameterCollection Class
Members  Example 



Teradata.Client.Provider Namespace : TdParameterCollection Class
Represents a collection of TdParameter objects associated with a TdCommand object.
Object Model
TdParameterCollection ClassTdParameter Class
Syntax
Remarks

Parameterized SQL statements accept one or more input parameters (TdParameter). TdParameter represents the data value and can be associated with TdCommand objects using TdCommand.Parameters property. TdCommand.Parameters is an instance of TdParameterCollection and holds all input, input-output and output parameters.

It is highly recommended that parameterized queries be used in order to take advantage of the Teradata Statement-Cache. See the Teradata SQL manual for additional information.

Example
The following example inserts a row into the Order table. TdParameter objects corresponding to the columns in Order table are added the Parameters collection (TdParameterCollection) of the TdCommand object before it is executed using TdCommand.ExecuteNonQuery.
public void InsertOrder(TdConnection cn, String orderId, 
                        String customerId, DateTime orderDate)
{
    TdCommand cmd = new TdCommand("Insert Into Order (OrderID, CustomerID, " + 
                                  "OrderDate) Values (?, ?, ?)",
                                   cn);
            
    cmd.Parameters.Add("orderId", TdType.Char, 15);
    cmd.Parameters.Add("customerId", TdType.Char, 10);
    cmd.Parameters.Add("orderDate", TdType.Date);
            
    cmd.Parameters["orderId"].Value = orderId;
    cmd.Parameters["customerId"].Value = customerId;
    cmd.Parameters["orderDate"].Value = orderDate;
            
    cmd.ExecuteNonQuery();
}
Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.Data.Common.DbParameterCollection
         Teradata.Client.Provider.TdParameterCollection

Requirements

Target Platforms: Windows 8.1, Windows 10, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019

See Also

Reference

TdParameterCollection Members
Teradata.Client.Provider Namespace