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



Teradata.Client.Provider Namespace : TdDataAdapter Class
TdDataAdpater fills a DataSet with the data from the Teradata Vantage Advanced SQL Engine and conversely updates the SQL Engine with the data in a DataSet.
Object Model
TdDataAdapter ClassTdCommand ClassTdCommand ClassTdCommand ClassTdCommand Class
Syntax
Remarks

The TdDataAdapter retrieves data from the SQL Engine and fills a single DataTable within a DataSet. It is also capable of reconciling changes (UPDATE, INSERT, DELETE) to the DataTable to the SQL Engine.

TdDataAdapter can create the DataTable(s) from SELECT statement�s metadata, or it can map the result set(s) to an existing DataTable(s). In either case, data is retrieved from the SQL Engine and inserted / merged into the DataTable. For additional information on naming conventions see DbDataAdapter.Fill method.

TdDataAdapter, working in conjunction with TdCommandBuilder, is capable of automatically generating DML (UPDATE, INSERT and DELETE) statements for reconciling updates to a DataSet. However, UpdateCommand, InsertCommand and DeleteCommand properties can be manually setup as needed or alternatively registered to listen for RowUpdating events and to modify the DML generated by the TdCommandBuilder.

The Data Provider will detect a Parameter declaration discrepancy when Batch Update (TdDataAdapter.UpdateBatchSize > 1) is enabled and Data.Common.DataAdapter.ContinueUpdateOnError is set to true. The Data Provider detects that the TdParameter.IsNullable property is set to false but the TdParameter.Value is set to DBNull.Value. The Data Provider sets the Data.DataRow.HasErrors property to true and Data.DataRow.RowError property to Error # 121007 when it detects this issue. The SQL Engine will detect this discrepancy when Batch Update (UpdateBatchSize == 1) is turned off or ContinueUpdateOnError is set to false. The SQL Engine will return error # 2869.

Example
The following example fills a DataSet with result set(s) returned from Teradata Database.
public DataSet CreateDataSet(String connectionString, String commandText)
{
   TdDataAdapter adapter = new TdDataAdapter(connectionString, commandText);
           
   DataSet ds = new DataSet();
   adapter.Fill(ds);
   return ds;
}
Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Data.Common.DataAdapter
            System.Data.Common.DbDataAdapter
               Teradata.Client.Provider.TdDataAdapter

Requirements

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

See Also

Reference

TdDataAdapter Members
Teradata.Client.Provider Namespace