Send feedback on this topic.
Teradata.Client.Provider
Developing .NET Data Provider for Teradata Applications
.NET Data Provider for Teradata > Developer's Guide > Developing .NET Data Provider for Teradata Applications

To use the .NET Data Provider for Teradata, you need to do the following:

  1. Add a reference in your project to the Teradata.Client.Provider.dll assembly.
  2. Add an imports or using statement for Teradata.Client.Provider namespace in your code.
  3. Read the documentation for the following core objects to get familiar with the .NET Data Provider for Teradata.
Object Description
TdConnection
  • Establishes a connection to the Teradata Vantage and provides implicit and explicit transaction control.
  • Factory for TdCommand objects.
TdCommand
  • Executes parameterized and non-parameterize SQL statements.
  • Maps .NET data types to Vantage data types (Parameters).
  • Factory for TdDataReader objects.
TdDataReader
  • Exposes the result set (spool file) as a static forward-only cursor.
  • Maps Vantage data types to .NET data types.
TdDataAdapter
  • Uses TdDataReader to fill a DataSet.
  • Applies changes to the DataSet back to the Advanced SQL Engine.

Example

The Hello World example below illustrates making a Connection to Vantage and executing "Select Date" using the TdDataReader.

  1. Create a C# Console project.
  2. Open the "Program.cs" file, Copy and Paste the below code into your file.
  3. Remember to Add a reference in your project to the Teradata.Client.Provider.dll assembly.
  4. Change the Data Source, User ID and Password on the "TdConnection" line of code listed below.
  5. Build the project.
C#
Copy Code
using System;
using System.Collections.Generic;
using System.Text;
using Teradata.Client.Provider;

namespace Teradata.Client.Provider.HelloWorld
{
    class HelloWorld
    {
        static void Main(string[] args)
        {
            using (TdConnection cn = new TdConnection("Data Source = x;User ID = y;Password = z;"))
            {
                cn.Open();
                TdCommand cmd = cn.CreateCommand();
                cmd.CommandText = "SELECT DATE";
                using (TdDataReader reader = cmd.ExecuteReader())
                {
                    reader.Read();
                    DateTime date = reader.GetDate(0);
                    Console.WriteLine("Teradata Database DATE is {0}", date);
                 }
             }
         }
    }
}
Note
You can find more Coding Examples at <Installation-Directory>\Samples\LearningExamples directory.

See Also

Accessing Data

ADO.NET