Send feedback on this topic.
TdParameter Class
Members  Example 

Teradata.Client.Provider Namespace : TdParameter Class
Represents a parameter to a SQL statement.
Public NotInheritable Class TdParameter 
   Inherits System.Data.Common.DbParameter
   Implements System.Data.IDataParameterSystem.Data.IDbDataParameterSystem.ICloneable 
Dim instance As TdParameter

Parameterized SQL statements accept one or more input parameters (data). TdParameter represents the data value and can be associated with TdCommand objects using TdCommand.Parameters property. TdParameter describes the .NET data type and the corresponding Teradata column type. The data provider converts .NET data types to Teradata data types before it is sent to Teradata Database for processing. The data provider cannot derive parameter data type information from Teradata when the TdCommand is prepared. Therefore, the data provider relies on information provided by the TdParameter object or it implicitly maps the .NET data type to Teradata data type.

Teradata Stored Procedures also support output and input-output parameters. TdParameter can correctly map .NET data types to Teradata data types and back and therefore fully support Input, Input-Output and Output parameters to SQL statements.

The data provider does not support the USING CLAUSE. All SQL statements should use parameter markers (Question Mark) as oppose to USING CLAUSE and parameter names prefixed with the colon character.

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

For information on how to specify a LOB as a parameter please refer to TdParameter.Value

The following example inserts a row into the Order table. TdParameter objects corresponding to the columns in Order table are added to 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 (?, ?, ?)",
    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;
Inheritance Hierarchy



Target Platforms: Windows 7, Windows 8, Windows 8.1, Windows 10, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2

See Also


TdParameter Members
Teradata.Client.Provider Namespace